Mnemonix v0.2.0 Mnemonix.ETS.Store
A Mnemonix.Store
adapter that uses an ETS table to store state.
iex> {:ok, store} = Mnemonix.ETS.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 ETS table to store state
Callback implementation for Mnemonix.Store.Behaviour.put/3
Starts a new Mnemonix.Store
using the
Mnemonix.ETS.Store
adapter
Starts a new Mnemonix.Store
using the Mnemonix.ETS.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 ETS table to store state.
Options
table:
Name of the table to create. Default:Mnemonix.ETS.Store.Table
named:
ETS named table option Default:false
If making a non-public table it’s reccommened to use this option, so that the table name can be used outside of this store.
privacy:
ETS privacy option -:public | :protected | :private
Default::private
heir:
ETS heir option -{pid, any} | nil
Default: niltransactional
: Whether or not to perform transactional reads or writes. Allowed::reads | :writes | :both | nil
Default:nil
compressed
: Whether or not to compress the values being stored. Default:false
Callback implementation for Mnemonix.Store.Behaviour.put/3
.
Starts a new Mnemonix.Store
using the
Mnemonix.ETS.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.ETS.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.ETS.Store
adapter
with init
opts.
The returned GenServer.server/0
reference can be used as the primary
argument to the Mnemonix
API.