HexpmMcp.Cache (hexpm_mcp v0.3.2)

Copy Markdown View Source

ETS-based response cache with configurable TTL and periodic sweeping.

Summary

Functions

Returns a specification to start this module under a supervisor.

Clear all cached entries.

Fetch a cached value or compute it.

Look up a cached value by key.

Store a value in the cache.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear()

Clear all cached entries.

fetch(key, ttl \\ nil, fun)

Fetch a cached value or compute it.

Returns the cached value if present and not expired, otherwise calls fun and caches the result.

lookup(key)

Look up a cached value by key.

put(key, value)

Store a value in the cache.

start_link(opts \\ [])