Mnemonix v0.10.0 Mnemonix.Features.Supervision View Source
Functions that allow supervision of a store.
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.
All of these functions are available on the main Mnemonix module.
Link to this section Summary
Functions
Starts a new store using the default store impl and options
Starts a new store using the provided store impl and options
Link to this section Functions
Starts a new store using the default store impl and options.
See start_link/2 for more control.
start_link(Mnemonix.Store.Behaviour.t(), Mnemonix.Supervisor.options()) :: GenServer.on_start()
Starts a new store 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.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: NamedStore]]
iex> {:ok, _store} = Mnemonix.start_link(Mnemonix.Stores.Map, options)
iex> Mnemonix.get(NamedStore, :foo)
:bar