erlangmc


EMC: Erlang MemCached Client

Description

EMC (Erlang MemCached Client) is a simple wrapper of the memcached library 'libmemcached' created by TangentOrg. EMC provides an Erlang/OTP API to allow the connection to memcached servers from Erlang applications.

Features

  • Set, get & multi-get operations of any valid Erlang term.
  • Increment & decrement operations.
  • Delete & flush operations.
  • Access to server's stats.
  • Timed operations.
  • Dynamic pool of reusable connections.
  • Fully configurable via external text file.
  • Built-in pluggable logging infrastructure.
  • Access to almost all libmemcached behaviors (NO_BLOCK, TCP_NODELAY, HASH, DISTRIBUTION, CACHE_LOOKUPS, USE_UDP, SUPPORT_CAS, POLL_TIMEOUT, BUFFER_REQUESTS, VERIFY_KEY, SORT_HOSTS and CONNECT_TIMEOUT).

Usage

Install libmemcached, check out EMC (hg clone https://erlangmc.googlecode.com/hg/ emc), configure (make configure), compile (make), set-up (edit emc) and simply launch an Erlang shell to test it!

``` $ ./emc start testnode

Erlang (BEAM) emulator version 5.6.5

(testnode@rulo)1> emc.emc:set("k1", lists:seq(1,7), null). ok

(testnode@rulo)2> emc.emc:get("k1"). {ok,[1,2,3,4,5,6,7]}

(testnode@rulo)3> emc.emc:get("k2"). {error,not_found}

(testnode@rulo)4> emc.emc:set("k2", erlang:now(), null). ok

(testnode@rulo)5> emc.emc:mget(["k1", "k2", "k3"]). {ok,[{"k2",{1244,305260,999518}}, {"k1",[1,2,3,4,5,6,7]}]}

(testnode@rulo)6> emc.emc:delete(k2, null). ok

(testnode@rulo)7> emc.emc:rset("k3", "10", null). ok

(testnode@rulo)8> emc.emc:increment("k3", 1). {ok,11}

(testnode@rulo)9> emc.emc:increment("k3", 1). {ok,12} ```

Some Related Projects

Project Information

Labels:
Erlang memcached client libmemcached