Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rpcxio/gomemcached
memcached protocol for server implementation
https://github.com/rpcxio/gomemcached
golang memcached memcached-server
Last synced: 3 days ago
JSON representation
memcached protocol for server implementation
- Host: GitHub
- URL: https://github.com/rpcxio/gomemcached
- Owner: rpcxio
- License: mit
- Created: 2020-02-23T14:22:06.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-04T07:39:00.000Z (almost 3 years ago)
- Last Synced: 2024-09-22T09:18:35.324Z (about 2 months ago)
- Topics: golang, memcached, memcached-server
- Language: Go
- Size: 17.6 KB
- Stars: 12
- Watchers: 3
- Forks: 4
- 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.[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![GoDoc](https://godoc.org/github.com/rpcxio/gomemcached?status.png)](http://godoc.org/github.com/rpcxio/gomemcached) [![travis](https://travis-ci.org/smallnest/gomemcached.svg?branch=master)](https://travis-ci.org/smallnest/gomemcached) [![Go Report Card](https://goreportcard.com/badge/github.com/rpcxio/gomemcached)](https://goreportcard.com/report/github.com/rpcxio/gomemcached) [![Coverage Status](https://coveralls.io/repos/smallnest/gomemcached/badge.svg?branch=master&service=github)](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)
// or use unix domain socket, like:
// addr := "unix:///tmp/memcached.sock"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.