Binary Memcached client for Go with SASL support
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore Move source, remove submoduoles (use go get), renamed some files May 18, 2018
.gitmodules
.travis.yml
LICENSE Update readme and license. May 4, 2015
Makefile Put source in root dir to make importing easier (this is ugly go for … Jun 5, 2018
README.md Update README.md Aug 31, 2018
TODO.md Update readme and todo Jun 3, 2018
bench_test.go
client.go Export Config struct Jun 12, 2018
client_test.go fmt the code Jun 6, 2018
config.go Export Config struct Jun 12, 2018
failure_test.go fmt the code Jun 6, 2018
hasher.go Export modulo hasher Jun 6, 2018
mock_conn.go Export Config struct Jun 12, 2018
protocol.go Put source in root dir to make importing easier (this is ugly go for … Jun 5, 2018
server.go
server_conn.go Export Config struct Jun 12, 2018
utils_test.go Improve documentation Jun 6, 2018

README.md

mc.go: A Go client for Memcached

godoc Build Status

This is a (pure) Go client for Memcached. It supports the binary Memcached protocol and SASL authentication. It's thread-safe. It allows connections to entire Memcached clusters and supports connection pools, timeouts, and failover.

Install

$ go get github.com/memcachier/mc

Use

import "github.com/memcachier/mc"

func main() {
	// Error handling omitted for demo

	// Only PLAIN SASL auth supported right now
	c := mc.NewMC("localhost:11211", "username", "password")
	defer c.Quit()

	exp := 3600 // 2 hours
	cas, err = c.Set("foo", "bar", flags, exp, cas)
	if err != nil {
		...
	}

	val, flags, cas, err = c.Get("foo")
	if err != nil {
		...
	}

	err = c.Del("foo")
	if err != nil {
		...
	}
}

Missing Feature

There is nearly coverage of the Memcached protocol. The biggest missing protocol feature is support for multi_get and other batched operations.

There is also no support for asynchronous IO.

Performance

Right now we use a single per-connection mutex and don't support pipe-lining any operations. There is however support for connection pools which should make up for it.

Get involved!

We are happy to receive bug reports, fixes, documentation enhancements, and other improvements.

Please report bugs via the github issue tracker.

Master git repository:

  • git clone git://github.com/memcachier/mc.git

Licensing

This library is MIT-licensed.

Authors

This library is written and maintained by MemCachier. It was originally written by Blake Mizerany.