macula_rpc_cache (macula v0.20.5)
View SourceLRU cache for RPC procedure results. Caches results of idempotent procedures to avoid repeated execution. Wraps macula_cache with RPC-specific logic and TTL handling.
Summary
Functions
Clear all entries.
Get entry from cache. Returns {ok, Result, UpdatedCache} or not_found. The updated cache has the entry moved to front (LRU). Automatically removes expired entries.
Invalidate (remove) entry.
Check if entry is expired.
Make cache key from URI and args. Uses hash of URI and args for consistent key generation.
Get max size.
Create new cache with max size.
Put entry in cache.
Put entry with custom timestamp (for testing).
Get number of entries.
Types
-type cache() :: macula_cache:cache().
Functions
Clear all entries.
Get entry from cache. Returns {ok, Result, UpdatedCache} or not_found. The updated cache has the entry moved to front (LRU). Automatically removes expired entries.
Invalidate (remove) entry.
Check if entry is expired.
Make cache key from URI and args. Uses hash of URI and args for consistent key generation.
-spec max_size(cache()) -> pos_integer().
Get max size.
-spec new(pos_integer()) -> cache().
Create new cache with max size.
Put entry in cache.
Put entry with custom timestamp (for testing).
-spec size(cache()) -> non_neg_integer().
Get number of entries.