Mnemonix v0.4.0 Mnemonix.Redix.Store
A Mnemonix.Store
that uses Redix to store state in redis.
iex> {:ok, store} = Mnemonix.Redix.Store.start_link
iex> Mnemonix.put(store, :foo, "bar")
iex> Mnemonix.get(store, :foo)
"bar"
iex> Mnemonix.delete(store, :foo)
iex> Mnemonix.get(store, :foo)
nil
Summary
Functions
Callback implementation for c:Mnemonix.Store.Core.Behaviour.delete/2
Callback implementation for c:Mnemonix.Store.Core.Behaviour.fetch/2
Callback implementation for c:Mnemonix.Store.Core.Behaviour.put/3
Connects to redis to store data
Starts a new Mnemonix.Store
using the Mnemonix.Redix.Store
module
Starts a new Mnemonix.Store
using the Mnemonix.Redix.Store
module
with init
opts
Functions
Callback implementation for c:Mnemonix.Store.Core.Behaviour.delete/2
.
Callback implementation for c:Mnemonix.Store.Core.Behaviour.fetch/2
.
Callback implementation for c:Mnemonix.Store.Core.Behaviour.put/3
.
Connects to redis to store data.
Options
conn:
The Redis to connect to, as either a string or list of opts w/ host, port, password, and database.Default:
"redis://localhost:6379"
All other options are passed verbatim to Redix.start_link/2
.
Starts a new Mnemonix.Store
using the Mnemonix.Redix.Store
module.
If you wish to pass configuration options to the module instead,
use start_link/2
with an empty opts
list.
The returned GenServer.server/0
reference can be used as the primary
argument to the Mnemonix
API.
Examples
iex> {:ok, store} = Mnemonix.Redix.Store.start_link
iex> Mnemonix.put(store, :foo, "bar")
iex> Mnemonix.fetch(store, :foo)
{:ok, "bar"}
iex> Mnemonix.delete(store, :foo)
iex> Mnemonix.fetch(store, :foo)
:error
Starts a new Mnemonix.Store
using the Mnemonix.Redix.Store
module
with init
opts.
The returned GenServer.server/0
reference can be used as the primary
argument to the Mnemonix
API.