Lotus.Cache.Relay (Lotus v1.2.0)

Copy Markdown View Source

Applies cache invalidations sent by other nodes to this node's adapter.

Lotus.Cache.delete/1 and Lotus.Cache.invalidate_tags/1 apply their change locally and, when Lotus.Cache.scope/1 answers :node for that operation, send it on the :cache topic of Lotus.Notifier. This process listens on that topic on every node and calls the same adapter function locally, without notifying again. Values never travel: a node whose entry was dropped fills it on its next miss.

Each notification is applied in its own task under Lotus's task supervisor, so a slow adapter call, such as a routed delete that waits on a node that stopped answering, does not hold up the notifications behind it. Relayed operations are idempotent deletes, so their order does not matter.

Lotus.Supervisor starts one relay per node after the cache adapter.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()