Mnemonix v0.1.0 Mnemonix.Mnesia.Store
A Mnemonix.Store
adapter that uses a Mnesia table to store state.
Before using, you must have started Mnesia:
iex> :mnesia.create_schema([node])
iex> :mnesia.start()
:ok
iex> {:ok, store} = Mnemonix.Mnesia.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 Mnesia table to store state in
Callback implementation for Mnemonix.Store.Behaviour.put/3
Starts a new Mnemonix.Store
using the Elixir.Mnemonix.Mnesia.Store
adapter
Starts a new Mnemonix.Store
using the Elixir.Mnemonix.Mnesia.Store
adapter with init
opts
Functions
Callback implementation for Mnemonix.Store.Behaviour.delete/2
.
Callback implementation for Mnemonix.Store.Behaviour.fetch/2
.
Creates a Mnesia table to store state in.
If the table specified already exists, it will use that instead.
Options
table:
Name of the table to use, will be created if it doesn’t exist. Default:Elixir.Mnemonix.Mnesia.Store.Table
transactional
: Whether or not to perform transactional reads or writes. Allowed::reads | :writes | :both | nil
Default::both
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 Elixir.Mnemonix.Mnesia.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.on_start/0
reference can be used in the Mnemonix
API.
Examples
iex> {:ok, store} = Elixir.Mnemonix.Mnesia.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
Starts a new Mnemonix.Store
using the Elixir.Mnemonix.Mnesia.Store
adapter with init
opts.
The returned GenServer.on_start/0
reference can be used in the Mnemonix
API.