Skip to content
async, non-blocking memcached client using akka
Find file
Latest commit 7194238 @dyross dyross update readme
Failed to load latest commit information.
project Re-added plugins.sbt
.gitignore Consistent hashing works.
build.sbt some cleanup


async, non-blocking memcached client using akka

inspired by, but much simpler than, this project:

info on akka io / iteratee library:


This client is has not seen extensive production testing and should be used with care.



  • Supports set, get, and delete memcached instructions
  • All instructions are non-blocking.
  • The set and delete methods are fire-and-forget, the get method returns an akka.dispatch.Future
  • Uses consistent hashing to distribute data across multiple memcached servers
  • Deduplicates keys: If multiple clients make a request for the same key, only a single get request will be made for that key, and results will be forwarded to each requesting client
  • Will reconnect to memcached if the connection is lost, and will complete any pending futures if the connection is re-established

How to build


  • Include this jar in your project
  • Create a new instance of RealMemcachedClient
  • It is necessary to have an implicit serializer when calling the get or set client methods


import akka.util.duration._
import akka.util.Timeout
import akka.dispatch.Await
import com.klout.akkamemcached.RealMemcachedClient
import com.klout.akkamemcached.Serialization.JBoss

object Test {
    // Create a client that connects to localhost on a single connection
    val client = new RealMemcachedClient(List(("localhost", 11211)), 1)

    // Store a value
    client.set("key", "value", 1 hour)

    // Retrieve a value
    val valueFuture = client.get("key")
    val result = Await.result(valueFuture, 5 seconds)

    // Delete a value
Something went wrong with that request. Please try again.