Cache.PersistentTerm (elixir_cache v0.4.6)

View Source

:persistent_term adapter for storing rarely-written, frequently-read cached values.

This adapter stores values in Erlang's :persistent_term storage, which provides extremely fast read access at the cost of more expensive writes and deletes. It is best suited for configuration values or other data that changes infrequently.

TTL is not supported — values persist until explicitly deleted.

Example

defmodule MyApp.Cache do
  use Cache,
    adapter: Cache.PersistentTerm,
    name: :my_app_persistent_cache,
    opts: []
end

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

arg is passed as the argument to Task.start_link/1 in the :start field of the spec.

For more information, see the Supervisor module, the Supervisor.child_spec/2 function and the Supervisor.child_spec/0 type.