ProtoRune. Atproto. Identity. Cache
(proto_rune v0.5.1)
Copy Markdown
Provides caching for AT Protocol identity resolution results.
This module maintains two ETS tables:
- handle_cache: Maps handles to DIDs with TTL
- did_cache: Stores DID documents with TTL
The cache automatically expires entries and provides concurrent access with proper cleanup.
Supervision
ProtoRune is a library and starts no processes of its own. To enable identity caching, add the cache to your application's supervision tree:
children = [
ProtoRune.Atproto.Identity.Cache
]When the cache is not running, lookups behave as misses and writes are dropped, so resolution still works (uncached).
Summary
Functions
Returns a specification to start this module under a supervisor.
Gets a cached DID for a handle. Returns {:ok, did} if found and not expired, otherwise {:error, reason}.
Gets a cached DID document. Returns {:ok, doc} if found and not expired, otherwise {:error, reason}.
Invalidates cached data for a DID.
Invalidates cached data for a handle.
Stores a handle -> DID mapping in the cache.
Stores a DID document in the cache.
Returns cache statistics.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Gets a cached DID for a handle. Returns {:ok, did} if found and not expired, otherwise {:error, reason}.
Gets a cached DID document. Returns {:ok, doc} if found and not expired, otherwise {:error, reason}.
@spec invalidate_did(String.t()) :: :ok
Invalidates cached data for a DID.
@spec invalidate_handle(String.t()) :: :ok
Invalidates cached data for a handle.
Stores a handle -> DID mapping in the cache.
Stores a DID document in the cache.
@spec stats() :: map()
Returns cache statistics.