pub enum PutResult<K, V> {
Put,
Update(V),
Evicted {
key: K,
value: V,
},
EvictedAndUpdate {
evicted: (K, V),
update: V,
},
}
Expand description
PutResult
is returned when try to put a entry in cache.
-
PutResult::Put
means that the key is not in cache previously, and the cache has enough capacity, no evict happens. -
PutResult::Update
means that the key already exists in the cache, and this operation updates the key’s value and the inner is the old value. -
PutResult::Evicted
means that the the key is not in cache previously, but the cache is full, so the evict happens. The inner is the evicted entry(Key, Value)
. -
PutResult::EvictedAndUpdate
is only possible to be returned byTwoQueueCache
andAdaptiveCache
. For more information, please see the related examples ofTwoQueueCache
andAdaptiveCache
Variants§
Put
Put
means that the key is not in cache previously, and the cache has enough
capacity, no evict happens.
Update(V)
Update
means that the key already exists in the cache,
and this operation updates the key’s value and the inner is the old value
Evicted
Evicted
means that the the key is not in cache previously,
but the cache is full, so the evict happens. The inner is the evicted entry (Key, Value)
.
EvictedAndUpdate
EvictedAndUpdate
is only possible to be returned by TwoQueueCache
.
For more information, please see the related examples of TwoQueueCache
.