https://github.com/smallnest/gomemcached
memcached protocol implementation for memcached server
https://github.com/smallnest/gomemcached
golang memcached protocol
Last synced: 29 days ago
JSON representation
memcached protocol implementation for memcached server
- Host: GitHub
- URL: https://github.com/smallnest/gomemcached
- Owner: smallnest
- License: mit
- Created: 2017-09-21T09:55:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-23T13:43:21.000Z (about 5 years ago)
- Last Synced: 2025-03-19T06:42:43.618Z (about 1 month ago)
- Topics: golang, memcached, protocol
- Language: Go
- Size: 9.77 KB
- Stars: 13
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gomemcached
Memcached protocol implementation for memcached server.
You can use it to create a memcached server easily.[](https://opensource.org/licenses/MIT) [](http://godoc.org/github.com/rpcxio/gomemcached) [](https://travis-ci.org/smallnest/gomemcached) [](https://goreportcard.com/report/github.com/rpcxio/gomemcached) [](https://coveralls.io/github/smallnest/gomemcached?branch=master)
import this lib:
```sh
go get -u github.com/rpcxio/gomemcached
```And register handlers.
```go
addr = "127.0.0.1:" + strconv.Itoa(port)
mockServer = NewServer(addr)
mockServer.RegisterFunc("get", DefaultGet)
mockServer.RegisterFunc("gets", DefaultGet)
mockServer.RegisterFunc("set", DefaultSet)
mockServer.RegisterFunc("delete", DefaultDelete)
mockServer.RegisterFunc("incr", DefaultIncr)
mockServer.RegisterFunc("flush_all", DefaultFlushAll)
mockServer.RegisterFunc("version", DefaultVersion)
mockServer.Start()
```This project refers to the below projects:
- [luxuan/go-memcached-server](https://github.com/luxuan/go-memcached-server)
- [zobo/mrproxy](https://github.com/zobo/mrproxy)I added more implementation and fix some issues, for example, panic on reading long value. I also add `Context` in handlers so that we can pass more info to handlers.