Julia memcached client
9 Stars
Updated Last
3 Years Ago
Started In
February 2014

Julia Memcache Client

Build Status Coverage Status

A pure Julia client for memcached servers. All memcached commands as of memcached version 1.4.17 are implemented.

Both numbers and strings are stored in plain string format so as to be interoperable with other memcached client libraries. Other Julia types are stored in their serialized form.

Type MemcacheClient represents a connection to a single memcached server instance.

Type MemcacheClients wraps over multiple MemcacheClient instances to provide distributed cache across more than one memcached server instances. Operations are routed to appropriate server based on key hash value.


  • Setting and getting data: set, cas, add, replace, append, prepend, incr, decr, get, touch
  • Administration: stats, version, flush_all, close, slabs_reassign, slabs_automove, quit

All methods are supported for both MemcacheClient and MemcacheClients, but results of administration commands would return and array of responses from all servers. See memcached command documentation for details of administration commands.

Below is an illustration of using the most common commands.

julia> using Memcache

julia> # create a client connection

julia> mc = MemcacheClient("localhost", 11211);


julia> # simple set and get

julia> set(mc, "key1", "val1")

julia> set(mc, "key2", 2)

julia> get(mc, "key1")


julia> # multi get

julia> get(mc, "key1", "key2")


julia> # increment, decrement

julia> incr(mc, "key2", 8)

julia> decr(mc, "key2", 3)


julia> # append, prepend

julia> append(mc, "key1", "--")

julia> prepend(mc, "key1", "--")

julia> get(mc, "key1")


julia> # cas

julia> res = get(mc, "key1", cas=true)

julia> val,casval = res["key1"]

julia> cas(mc, "key1", 2, casval)

julia> get(mc, "key1")


  • compression
  • optimize multi get for MemcacheClients