Provide a way to restore a Cache
from entries with metadata and a FrequencySketch
snapshot
#314
Labels
enhancement
New feature or request
CC: @peter-scholtens
When #312 and #313 are implemented, we will have enough data to restore a cache to a previous state. Provide a way to restore cache from them.
Inputs:
CacheBuilder
with configurations such as:Output:
Cache
initialized with the given inputs.Example
How it will work
CacheBuilder
has following methods that returns aCacheLoader
:loader(self)
loader_with_hasher(self, BuildHasher)
loader_with_frequency_sketch(self, FrequencySketch, BuildHasher)
FrequencySketch
with theBuildHasher
.CacheLoader
has aCache
but it is yet private.insert
is called on theCacheLoader
, it will do the followings:Cache
.EntryInfo
from the given metadata.(Arc<K>, last_accessed)
to aVec
.(Arc<K>, last_modified)
to anotherVec
.finish
is called, it will do the followings:Vec
s bylast_accessed
andlast_modified
respectively.Vec
bylast_accessed
.Vec
bylast_modified
.run_pending_tasks
(moka v0.12.x) several times to evict expired entries, and if the max capacity is exceeded, evict idle entries.Cache
.The text was updated successfully, but these errors were encountered: