Nebulex adapter using Mnesia as storage.
Add nebulex_mnesia_adapter to your list of dependencies in mix.exs:
def deps do
[
{:nebulex_mnesia_adapter, "~> 2.6.5"}
]
endCreate the cache module as the following example:
defmodule MyApp.Cache do
use Nebulex.Cache,
otp_app: :my_app,
adapter: Nebulex.Adapters.Mnesia
endYou can configure the cache in your config/config.exs file. For example:
config :my_app, MyApp.Cache,
table: :other_table_name, # (default: MyApp.Cache)
cleanup_interval: :timer.hours(2) # 2 hours (default: 6 hours)It is also recommended to set the mnesia directory for disc copies on config/config.exs
config :mnesia, dir: ~c"/path/to/my/db/folder"If you are pushing this to an environment ensure the folder is created ahead of time, Mnesia will not create the folder for you.
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/nebulex_mnesia_adapter.