Mnemonix v0.10.0 Mnemonix.Stores.Null View Source
A Mnemonix.Store
that does literally nothing.
iex> {:ok, store} = Mnemonix.Stores.Null.start_link
iex> Mnemonix.put(store, "foo", "bar")
iex> Mnemonix.get(store, "foo")
nil
iex> Mnemonix.delete(store, "foo")
iex> Mnemonix.get(store, "foo")
nil
This store supports the functions in Mnemonix.Features.Enumerable
.
Link to this section Summary
Functions
Callback implementation for c:Mnemonix.Store.Behaviours.Map.delete/2
Callback implementation for c:Mnemonix.Store.Behaviours.Map.fetch/2
Callback implementation for c:Mnemonix.Store.Behaviours.Map.put/3
Skips setup since this store does nothing
Starts a new store using the Mnemonix.Stores.Null
module with options
Starts a new store using Mnemonix.Stores.Null
with store
and server
options
Link to this section Functions
delete(Mnemonix.Store.t(), Mnemonix.key()) :: {:ok, Mnemonix.Store.t()}
Callback implementation for c:Mnemonix.Store.Behaviours.Map.delete/2
.
fetch(Mnemonix.Store.t(), Mnemonix.key()) :: {:ok, Mnemonix.Store.t(), {:ok, Mnemonix.value()}}
Callback implementation for c:Mnemonix.Store.Behaviours.Map.fetch/2
.
put(Mnemonix.Store.t(), Mnemonix.key(), Mnemonix.Store.value()) :: {:ok, Mnemonix.Store.t()}
Callback implementation for c:Mnemonix.Store.Behaviours.Map.put/3
.
Skips setup since this store does nothing.
Ignores all opts
.
start_link(Mnemonix.Supervisor.options()) :: GenServer.on_start()
start_link(Mnemonix.Supervisor.options()) :: GenServer.on_start()
Starts a new store using the Mnemonix.Stores.Null
module with options
.
The options
are the same as described in Mnemonix.Features.Supervision.start_link/2
.
The :store
options are used in config/1
to start the store;
the :server
options are passed directly to GenServer.start_link/2
.
The returned GenServer.server/0
reference can be used as the primary
argument to the Mnemonix
API.
Examples
iex> {:ok, store} = Mnemonix.Stores.Null.start_link()
iex> Mnemonix.put(store, "foo", "bar")
iex> Mnemonix.get(store, "foo")
nil
iex> {:ok, _store} = Mnemonix.Stores.Null.start_link(server: [name: My.Mnemonix.Stores.Null])
iex> Mnemonix.put(My.Mnemonix.Stores.Null, "foo", "bar")
iex> Mnemonix.get(My.Mnemonix.Stores.Null, "foo")
nil
start_link(Mnemonix.Supervisor.options(), GenServer.options()) :: GenServer.on_start()
start_link(Mnemonix.Supervisor.options(), GenServer.options()) :: GenServer.on_start()
Starts a new store using Mnemonix.Stores.Null
with store
and server
options.
The options are the same as described in Mnemonix.start_link/2
.
The store
options are used in config/1
to start the store;
the server
options are passed directly to GenServer.start_link/2
.
The returned GenServer.server/0
reference can be used as the primary
argument to the Mnemonix
API.
Examples
iex> {:ok, store} = Mnemonix.Stores.Null.start_link([], [])
iex> Mnemonix.put(store, "foo", "bar")
iex> Mnemonix.get(store, "foo")
nil
iex> {:ok, _store} = Mnemonix.Stores.Null.start_link([], [name: My.Mnemonix.Stores.Null])
iex> Mnemonix.put(My.Mnemonix.Stores.Null, "foo", "bar")
iex> Mnemonix.get(My.Mnemonix.Stores.Null, "foo")
nil