Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An Erlang Memcached Client.
Erlang Perl
Branch: master
#1 Compare This branch is 23 commits ahead, 12 commits behind joewilliams:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
ebin
src
t
.gitignore
Emakefile
Makefile
NOTICES
README

README

merle : An erlang based memcached client.

Version : 0.3

Author : Joe Williams <joe@joetify.com>
Contributors : Nick Gerakines <nick@gerakines.net>, Attila Babo <attila.babo@gmail.com>

Info : http://github.com/joewilliams/merle/

merle uses LShift's gen_server2 module/behavior for faster message queues.
(http://hg.rabbitmq.com/rabbitmq-server/file/b95f2fd4e3f6/src/gen_server2.erl)

This code is available as Open Source Software under the MIT license.

Features:
* Support for stats, version, get, gets, delete, set, add, replace, cas, append, prepend, incr, decr, flush_all, verbosity

Changes:

0.3
This version implements the full 1.2.6 memcached specification but changed the return values
significantly since 0.2, it's not a drop-in replacement. Before each Erlang term was transfered
to and from binary by the library, all usage was transparent but limited. Commands like append,
prepend, incr, decr were impossible to implement because of the special binary format but even
retrieving more then a single key value at a time was not feasible. After the breaking changes
all these possible but with a compromise.

Usage:

* Connecting to memcached *

Using defaults:

> merle:connect().

Set your own:

> merle:connect("HOSTNAME", 11211).


* A few operations *

> merle:set(a, asdf).
ok
> merle:get(a).
[{{<<"a">>,0},<<"asdf">>}]]

> merle:set(a, asdf).
ok
> merle:gets(a).
[{{<<"a">>,0,4},<<"asdf">>}]
> merle:cas(a, 4, asdfasdf).
ok
> merle:getskey(a).
[{{<<"a">>,0,5},<<"asdf">>}]

> merle:delete(a).
ok

> merle:set(a, 1), merle:set(b, "hi"), merle:set(c, {"answer", 42}).
ok
> merle:get([a,b,c]).
[{{<<"a">>,0},<<"1">>},
 {{<<"b">>,0},<<"hi">>},
 {{<<"c">>,0},
  <<131,104,2,107,0,6,97,110,115,119,101,114,97,42>>}]

* Informational commands *

> merle:version().
["VERSION 1.2.6"]

> merle:stats(slabs).
["STAT 1:chunk_size 104","STAT 1:chunks_per_page 10082",
 "STAT 1:total_pages 1","STAT 1:total_chunks 10082",
 "STAT 1:used_chunks 10081","STAT 1:free_chunks 1",
 "STAT 1:free_chunks_end 10080","STAT active_slabs 1",
 "STAT total_malloced 1048528","END"]

> merle:stats().
["STAT pid 27195","STAT uptime 497","STAT time 1232843046",
 "STAT version 1.2.6","STAT pointer_size 64",
 "STAT rusage_user 0.000000","STAT rusage_system 0.008000",
 "STAT curr_items 1","STAT total_items 5","STAT bytes 83",
 "STAT curr_connections 2","STAT total_connections 5",
 "STAT connection_structures 3","STAT cmd_get 5",
 "STAT cmd_set 5","STAT get_hits 5","STAT get_misses 0",
 "STAT evictions 0","STAT bytes_read 216",
 "STAT bytes_written 468","STAT limit_maxbytes 67108864",
 "STAT threads 1","END"]
Something went wrong with that request. Please try again.