Assigns unique integer indices to arbitrary keys for a given cache.
Uses Cache.PersistentTerm for key-to-index mappings and :atomics
for a monotonic next-index counter per cache. Indices are zero-based
and never reused.
Summary
Functions
Read the index for a key without telemetry overhead.
Functions
@spec get_index(atom(), term()) :: non_neg_integer() | nil
Read the index for a key without telemetry overhead.
Goes directly to the configured cache adapter, skipping the
:telemetry.span/3-wrapped Cache.get/1. Returns nil when the
key has never been registered.
Companion to get_or_register/2 — use this when callers must not
allocate a new index on miss.
@spec get_or_register(atom(), term()) :: non_neg_integer()
@spec init_counter(atom()) :: :ok