Lotus.Cache.ETS (Lotus v1.2.0)

Copy Markdown View Source

An ETS-based, local, in-memory cache adapter for Lotus.

This is the default cache adapter if none is specified.

In a cluster

Every node keeps its own entries and its own tag bookkeeping. scope/1 returns :node for both relayed operations, so Lotus.Cache relays each delete/1 and invalidate_tags/1 to the other nodes over Lotus.Notifier, and each node drops its own copies. Values are not shared: two nodes that run the same query each fill their own entry. Use Lotus.Cache.Cachex with a router when one entry should serve the whole cluster.

Tag bookkeeping

Each tag row carries the expiry of the entry it points at. The janitor that sweeps expired entries every 30 seconds sweeps expired tag rows the same way, so a tag that is never invalidated does not grow for the life of the node.

Summary

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

decode(bin)

See Lotus.Cache.Adapter.decode/1.

encode(value, compress \\ true)

See Lotus.Cache.Adapter.encode/2.

start_link(opts \\ [])