ExNominatim.Cache protocol (ExNominatim v3.0.0)

Copy Markdown View Source

Protocol for cache adapters used by ExNominatim.

Implement this protocol to provide custom caching backends. The built-in ExNominatim.CachexCache adapter caches via Cachex v4.x.

When a cache module implements get/1 and put/3 functions, the ExNominatim.Cache protocol is automatically dispatched via the defimpl for: Atom fallback — no explicit defimpl needed.

Summary

Types

t()

All the types that implement this protocol.

Functions

Retrieve a cached value by key. Returns {:ok, value} on hit, :miss on miss.

Store a value in the cache with the given TTL options.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

get(cache, key)

Retrieve a cached value by key. Returns {:ok, value} on hit, :miss on miss.

put(cache, key, value, opts)

Store a value in the cache with the given TTL options.