Provide a way to get a read-only snapshot of the FrequencySketch
of Cache
#313
Labels
enhancement
New feature or request
FrequencySketch
of Cache
#313
#311 (comment) by @peter-scholtens
Instead of providing the read frequency of a key in a
Cache
, we will provide a read-only snapshot of theFrequencySketch
, the historic popularity estimator, of theCache
.FrequencyScketch
.FrequencySketch
tracks the access counts of not only the keys that are currently in the cache, but also all the keys that have been attempted to get from the cache. (frequency is incremented for a key for both cache hit and miss).FrequencySketch
does not store the keys.FrequencySketch
is a part of theCache
state and guarded by a mutex.By #314, we can recreate a
Cache
with a givenFrequencySketch
snapshot andBuildHasher
.For the
FrequencySketch
snapshot, we will provide the following methods and functions:u8
) of a given key:FrequencySketch
into a serialized formBox<[u8]>
.Box<[u8]>
should contain all the information of theFrequencySketch
snapshot, plus:validate
method, which takes a hasher and verify the check sum.CacheBuilder
will call it when building aCacheLoader
with this frequency sketch snapshot and aBuildHasher
.The text was updated successfully, but these errors were encountered: