Dims.Cache (dims v0.1.0)

Copy Markdown View Source

Tiny ETS-backed TTL cache for probe results, started by the :dims application. Dimensions never change for a URL, so entries default to a 30-day TTL (set per call via :cache_ttl, or bypass with cache: false).

Degrades gracefully: if the table isn't available (application not started, e.g. :runtime disabled), fetch/3 just runs the fun.

Summary

Functions

Returns a specification to start this module under a supervisor.

Get key from cache or run fun, caching a non-nil result for ttl ms.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

fetch(key, ttl, fun)

Get key from cache or run fun, caching a non-nil result for ttl ms.

start_link(opts)