Karta. Cache
(Karta v1.0.0)
An in-memory (ETS) copy of data the SMTP listeners need for every command: domains, routes, credentials, suppressions, server settings. SMTP replies must never wait on the database, so lookups read ETS in the caller's process.
Each cache is one process and one named table, filled by a
Karta.Cache.Loader. It loads at start and then every reload_interval;
reload/1 reloads at once (for change notifications). Until the first
successful load the cache is cold and fetch/2 returns :cold; callers
then answer with a temporary failure (451 4.3.2). After that a failed
reload keeps the previous data (stale data beats refusing mail) and is
logged.
Summary
Functions
Returns a specification to start this module under a supervisor.
Looks up key. Never calls the database or the cache process.
Reloads now. Returns :ok or the loader's error.
Options: name (also the ETS table name), loader (a module), and
reload_interval in milliseconds (default 300 000).
True once the first load has succeeded.
Types
@type name() :: atom()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Looks up key. Never calls the database or the cache process.
Reloads now. Returns :ok or the loader's error.
Options: name (also the ETS table name), loader (a module), and
reload_interval in milliseconds (default 300 000).
True once the first load has succeeded.