/gomemcached

memcached protocol implementation for memcached server

Primary LanguageGoMIT LicenseMIT

gomemcached

Memcached protocol implementation for memcached server. You can use it to create a memcached server easily.

License: MIT GoDoc travis Go Report Card Coverage Status

import this lib:

go get -u github.com/rpcxio/gomemcached

And register handlers.

    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:

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.