Memcachir
Memcached client for Elixir
Installation
defp deps() do
...
{:memcachir, "~> 3.0"},
...
end
defp application() do
[applications: [:logger, :memcachir, ...]]
end
config :memcachir,
hosts: "localhost"
The hosts config allows multiple variants:
hosts: "localhost:11212" # specify port
hosts: ["host1", "host2", "host3:11212"] # cluster of servers
hosts: [{"host1", 10}, {"host2", 30}] # cluster with weights
Configuration
Complete configuration options with default values:
config :memcachir,
hosts: "localhost",
# memcached options
ttl: 0,
namespace: nil,
# connection pool options
pool: [
strategy: :lifo,
size: 10,
max_overflow: 10]
Example
iex> Memcachir.set("hello", "world")
{:ok}
iex> Memcachir.get("hello")
{:ok, "world"}