API Reference ActiveMemory v0.7.1
modules
Modules
Bring the power of in memory storage with ETS and Mnesia to your Elixir application.
The ActiveRepo
An ActiveRepo manages multiple ActiveMemory.Tables from a single process. It
is the multi-table counterpart to ActiveMemory.Store (which manages a single
table), giving you one supervised entry point and a unified API over many tables.
An adapter for storing structs in ETS
An adapter for storing structs in Mnesia
Migrations will get run on app startup and are designed to modify :mnesia's schema.
Starts the ActiveMemory supervision tree, which runs the
ActiveMemory.TableHeir process that preserves ETS tables across store
crashes and restarts.
The shared implementation of the table operations and store setup used by
ActiveMemory.Store and ActiveMemory.ActiveRepo.
the-match-query-syntax
The match query syntax
Using the match macro you can structure a basic query.
The Store
store-api
Store API
Store.all/0Get all records storedStore.delete/1Delete the record providedStore.delete_all/0Delete all records storedStore.one/1Get one record matching either an attributes search ormatchqueryStore.select/1Get all records matching either an attributes search ormatchqueryStore.withdraw/1Get one record matching either an attributes search ormatchquery, delete the record and return itStore.write/1Write a record into the memmory table
concurrency
Concurrency
A Store is a GenServer, but the data functions above (all/0, one/1,
select/1, write/1, delete/1, withdraw/1, delete_all/0) are not
routed through that process and are not serialized by it. They are ordinary
module functions that run in the caller's process, delegating straight to the
table's adapter (and therefore to :ets/:mnesia). Concurrency is governed by
ETS/Mnesia themselves, so many processes read and write in parallel — the single
GenServer is not a bottleneck. Only lifecycle and metadata operations (init,
state/0, reload_seeds/0) actually use the GenServer.
Define your table attributes and options.
Stable "owner of last resort" for the ETS tables created by ActiveMemory.Store.