memcachir v0.1.0 Memcachir.Worker

Example

{ :ok, pid } = Memcachir.Worker.start_link()
{ :ok } = Memcachir.Worker.set(pid, "hello", "world")
{ :ok, "world" } = Memcachir.Worker.get(pid, "hello")

Coder

Memcachir.Coder allows you to specify how the value should be encoded before sending it to the server and how it should be decoded after it is retrived. There are four built-in coders namely Memcachir.Coder.Raw, Memcachir.Coder.Erlang, Memcachir.Coder.JSON, Memcachir.Coder.ZIP. Custom coders can be created by implementing the Memcachir.Coder behaviour.

Summary

Functions

add(server \\ nil, key, value, opts \\ [])
append(server \\ nil, key, value, opts \\ [])
append_cas(server \\ nil, key, value, cas, opts \\ [])
cas(server \\ nil, key, update, opts \\ [])
close(server)
connection_pid(server)
decr(server \\ nil, key, opts \\ [])
decr_cas(server \\ nil, key, cas, opts \\ [])
delete(server \\ nil, key)
delete_cas(server \\ nil, key, cas)
execute(server, command, args, opts \\ [])
execute_k(server, command, list, opts \\ [])
execute_kv(server, command, list, opts)
flush(server \\ nil, opts \\ [])
get(server \\ nil, key, opts \\ [])
incr(server \\ nil, key, opts \\ [])
incr_cas(server \\ nil, key, cas, opts \\ [])
noop(server \\ nil)
prepend(server \\ nil, key, value, opts \\ [])
prepend_cas(server \\ nil, key, value, cas, opts \\ [])
replace(server \\ nil, key, value, opts \\ [])
replace_cas(server \\ nil, key, value, cas, opts \\ [])
set(server \\ nil, key, value, opts \\ [])
set_cas(server \\ nil, key, value, cas, opts \\ [])
start_link(connection_options \\ [])

Specs

start_link(Keyword.t) :: GenServer.on_start

Creates a connection using Memcachir.Connection.start_link/2

Connection Options

This is a superset of the connection options accepted by the Memcachir.Connection.start_link/2. The following list specifies the additional options.

  • :ttl - (integer) a default expiration time in seconds. This value will be used if the :ttl value is not specified for a operation. Defaults to 0(means forever).

  • :namespace - (string) prepend each key with the given value.

  • :coder - (module | {module, options}) Can be either a module or tuple contains the module and options. Defaults to {Memcachir.Coder.Raw, []}.
stat(server \\ nil, key \\ [])
version(server \\ nil)