Wraith. Settings. Cache
(Wraith v0.1.0)
View Source
The site item, read once instead of on every plug and mount.
Wraith.Settings.get/0 is called several times per request (redirects,
locale, the page's own mount, feeds); on DynamoDB each call was a network
round trip for a map that changes when an admin saves the settings form.
One ETS row, owned by this process, holds the merged item with the time it
was read. Writes go through Wraith.Settings.write/1, which put/1s the
fresh item here and broadcasts it on PubSub so every clustered node
swaps its copy at once. Nodes that aren't clustered still converge: a row
older than @ttl_ms is re-read from the store.
Summary
Functions
Returns a specification to start this module under a supervisor.
The cached item, or loader.() (cached for the next caller) when stale or missing.
Forget the cached item (tests, and after writes that bypass Settings).
A freshly written item: cache it here and on every other node.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
The cached item, or loader.() (cached for the next caller) when stale or missing.
@spec invalidate() :: :ok
Forget the cached item (tests, and after writes that bypass Settings).
@spec put(map()) :: :ok
A freshly written item: cache it here and on every other node.