Mnemonix v0.2.0 Mnemonix.DETS.Store
A Mnemonix.Store
adapter that uses a DETS table to store state.
iex> {:ok, store} = Mnemonix.DETS.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 Mnemonix.Store.Behaviour.delete/2
Callback implementation for Mnemonix.Store.Behaviour.fetch/2
Creates a new DETS table to store state
Callback implementation for Mnemonix.Store.Behaviour.put/3
Starts a new Mnemonix.Store
using the
Mnemonix.DETS.Store
adapter
Starts a new Mnemonix.Store
using the Mnemonix.DETS.Store
adapter
with init
opts
Functions
Callback implementation for Mnemonix.Store.Behaviour.delete/2
.
Callback implementation for Mnemonix.Store.Behaviour.fetch/2
.
Creates a new DETS table to store state.
If the DETS file already exists, will use the contents of that table.
Options
table:
Name of the table to connect to. Default:Mnemonix.DETS.Store.Table
The rest of the options are passed into :dets.open_file/2
verbaitm, except
for type:
, which will always be :set
.
Callback implementation for Mnemonix.Store.Behaviour.put/3
.
Starts a new Mnemonix.Store
using the
Mnemonix.DETS.Store
adapter.
If you wish to pass configuration options to the adapter 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.DETS.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
start_link(Mnemonix.Store.opts, GenServer.options) :: {:ok, GenServer.server}
Starts a new Mnemonix.Store
using the Mnemonix.DETS.Store
adapter
with init
opts.
The returned GenServer.server/0
reference can be used as the primary
argument to the Mnemonix
API.