Giter VIP home page Giter VIP logo

akka-memcached's Introduction

akka-memcached

async, non-blocking memcached client using akka

inspired by, but much simpler than, this project: https://github.com/derekjw/fyrie-redis

info on akka io / iteratee library: http://doc.akka.io/docs/akka/2.0.3/scala/io.html

Disclaimer

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

Maintainers

Features

  • 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

Usage

  • 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

Example

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
    client.delete("key")
}

akka-memcached's People

Contributors

zgrannan avatar dyross avatar

Watchers

Maddy Jean Muscari avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.