Mnemonix v0.8.0 Mnemonix.Store.Server
Bridges Mnemonix.Features with underlying Mnemonix.Stores.
This is normally the module you will be working with once you’ve selected your desired store implementation and want to insert it properly into a supervision tree.
The options here will allow you to specify your store type, keep your store always available, and decide on the process name for others to recognize it by, if any.
If you want to play around with the Mnemonix API first, see Mnemonix.new/0.
Summary
Types
A two-tuple describing a store type and options to start it
Options used to start a Mnemonix.Store.Server
Functions
Starts a new Mnemonix.Store.Server using the provided store impl and options
Starts a new Mnemonix.Store.Server using store impl, store options, and server options
Types
A two-tuple describing a store type and options to start it.
Options used to start a Mnemonix.Store.Server.
Functions
start_link(Mnemonix.Store.Behaviour.t, options) :: GenServer.on_start
Starts a new Mnemonix.Store.Server using the provided store impl and options.
Available options are:
:storeOptions to be given to the store on setup. Study the store
implfor more information.:serverA keyword list of options to be given to
GenServer.start_link/3.:otp_appFetches more options for the above from
config otp_app, module, options, and merges them together. If nootp_appis specified, will check underconfig :mnemonix, module, optionsfor default options. Options supplied directly to this function always take precedence over any found in your configuration.
The returned GenServer.server/0 reference can be used in the Mnemonix API.
Examples
iex> {:ok, store} = Mnemonix.Store.Server.start_link(Mnemonix.Stores.Map)
iex> Mnemonix.put(store, :foo, :bar)
iex> Mnemonix.get(store, :foo)
:bar
iex> options = [store: [initial: %{foo: :bar}], server: [name: StoreCache]]
iex> {:ok, _store} = Mnemonix.Store.Server.start_link(Mnemonix.Stores.Map, options)
iex> Mnemonix.get(StoreCache, :foo)
:bar
start_link(Mnemonix.Store.Behaviour.t, Mnemonix.Store.options, GenServer.opts) :: GenServer.on_start
Starts a new Mnemonix.Store.Server using store impl, store options, and server options.
store will be given to the store on setup. Study the store impl for more information.
server options be given to GenServer.start_link/3.
No application configuration checking option merging is performed.
Examples
iex> {:ok, store} = Mnemonix.Store.Server.start_link(Mnemonix.Stores.Map, [], [])
iex> Mnemonix.put(store, :foo, :bar)
iex> Mnemonix.get(store, :foo)
:bar
iex> store = [initial: %{foo: :bar}]
iex> server = [name: StoreCache]
iex> {:ok, _store} = Mnemonix.Store.Server.start_link(Mnemonix.Stores.Map, store, server)
iex> Mnemonix.get(StoreCache, :foo)
:bar