LRU cache for long->long mappings with bounded size.
This is a simple LRU cache - it doesn't know anything about Datomic IDs or entity indices. That logic belongs in the restore code that uses this cache.
LRU cache for long->long mappings with bounded size. This is a simple LRU cache - it doesn't know anything about Datomic IDs or entity indices. That logic belongs in the restore code that uses this cache.
Protocol for an LRU cache mapping long keys to long values.
Protocol for an LRU cache mapping long keys to long values.
(cache-size this)Returns the current number of entries in the cache.
Returns the current number of entries in the cache.
(cache-stats this)Returns stats about cache hits/misses/evictions.
Returns stats about cache hits/misses/evictions.
(lookup this k)Look up value for key k. Returns nil if not found. Marks entry as recently used.
Look up value for key k. Returns nil if not found. Marks entry as recently used.
(max-cache-size this)Returns the maximum allowed cache size.
Returns the maximum allowed cache size.
(store! this k v)Store mapping k->v. May evict least-recently-used entry if at capacity.
Store mapping k->v. May evict least-recently-used entry if at capacity.
(new-lru-cache)(new-lru-cache {:keys [max-size] :or {max-size default-max-cache-size}})Create a new LRU cache for long->long mappings.
Options:
Memory usage is approximately 48 bytes per entry.
Create a new LRU cache for long->long mappings. Options: - :max-size - Maximum number of entries before LRU eviction (default 1,000,000) Memory usage is approximately 48 bytes per entry.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |