Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/creack/go-redis-server
Redis server implementation in Go.
https://github.com/creack/go-redis-server
Last synced: about 1 month ago
JSON representation
Redis server implementation in Go.
- Host: GitHub
- URL: https://github.com/creack/go-redis-server
- Owner: creack
- License: apache-2.0
- Created: 2014-10-13T23:42:30.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-10-28T10:01:40.000Z (about 6 years ago)
- Last Synced: 2024-06-19T06:56:09.041Z (6 months ago)
- Language: Go
- Size: 81.1 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/creack/go-redis-server.png)](https://travis-ci.org/creack/go-redis-server)
Redis server protocol library
=============================There are plenty of good client implementations of the redis protocol, but not many *server* implementations.
go-redis-server is a helper library for building server software capable of speaking the redis protocol. This could be
an alternate implementation of redis, a custom proxy to redis, or even a completely different backend capable of
"masquerading" its API as a redis database.Sample code
------------```go
package mainimport (
redis "github.com/creack/go-redis-server"
)type MyHandler struct {
values map[string][]byte
}func (h *MyHandler) GET(key string) ([]byte, error) {
v := h.values[key]
return v, nil
}func (h *MyHandler) SET(key string, value []byte) error {
h.values[key] = value
return nil
}func main() {
handler, _ := redis.NewAutoHandler(&MyHandler{values: make(map[string][]byte)})
server := &redis.Server{Handler: handler, Addr: ":6389"}
server.ListenAndServe()
}
```