tinylfu_cached/cache/types/
mod.rs

1use std::time::SystemTime;
2
3/// Defines the type for the hash of a key
4pub type KeyHash = u64;
5
6/// Defines the type for total counter used in `crate::cache::lfu::frequency_counter::FrequencyCounter`,
7/// for counting the access frequencies of keys.
8pub type TotalCounters = u64;
9
10/// Defines type for the capacity of the cache in terms of the number of items the cache may store.
11pub type TotalCapacity = usize;
12
13/// Defines the type to denote if the client has specified the `time_to_live`.
14pub type IsTimeToLiveSpecified = bool;
15
16/// Defines the type for the total number of shards to be used for storing the key/value mapping.
17pub type TotalShards = usize;
18
19/// Defines the type for the weight of the cache, which is the total space reserved for the cache.
20pub type Weight = i64;
21
22/// Defines the type for the access frequency of keys in the cache.
23pub type FrequencyEstimate = u8;
24
25/// Defines the type for the id of each key.
26pub(crate) type KeyId = u64;
27
28/// Defines the type expiry of a key.
29pub(crate) type ExpireAfter = SystemTime;
30
31/// Defines the type for the capacity for DoorKeeper which is an implementation of BloomFilter.
32pub(crate) type DoorKeeperCapacity = usize;
33
34/// Defines the type for the false positive rate for DoorKeeper which is an implementation of BloomFilter.
35pub(crate) type DoorKeeperFalsePositiveRate = f64;