macula_cache (macula v0.14.3)
View SourceGeneric LRU cache implementation. Provides least-recently-used eviction with configurable max size.
Summary
Functions
Clear all entries.
Get entry from cache. Returns {ok, Value, UpdatedCache} or not_found. The updated cache has the entry moved to front (LRU).
Get all keys in cache (most recent first).
Get max size.
Create new cache with max size.
Put entry in cache with current timestamp.
Put entry in cache with custom timestamp (for testing).
Remove entry from cache.
Get number of entries.
Types
Functions
Clear all entries.
Get entry from cache. Returns {ok, Value, UpdatedCache} or not_found. The updated cache has the entry moved to front (LRU).
Get all keys in cache (most recent first).
-spec max_size(cache()) -> pos_integer().
Get max size.
-spec new(pos_integer()) -> cache().
Create new cache with max size.
Put entry in cache with current timestamp.
Put entry in cache with custom timestamp (for testing).
Remove entry from cache.
-spec size(cache()) -> non_neg_integer().
Get number of entries.