AshCache.Store (AshCache v0.1.0)

Copy Markdown View Source

Facade over the configured storage adapter.

Adapter resolution, most specific first:

  1. Process.put(:ash_cache_adapter, module) — per-process override, used by tests that need to swap storage for a single test
  2. config :ash_cache, adapter: module — app-wide configuration (the test env configures AshCache.Store.Adapters.ProcessLocal so async tests are isolated by construction)
  3. AshCache.Store.Adapters.Cachex — production default

Summary

Functions

adapter()

@spec adapter() :: module()

clear(store)

@spec clear(atom()) :: :ok | {:error, term()}

delete(store, key)

@spec delete(atom(), term()) :: :ok | {:error, term()}

get(store, key)

@spec get(atom(), term()) :: {:ok, term()} | {:error, term()}

put(store, key, value, opts \\ [])

@spec put(atom(), term(), term(), keyword()) :: :ok | {:error, term()}