K - Key classV - Value classpublic interface EvictionInterface<K,V> extends Serializable
FreezingEvictor instead of directly implementing EvictionInterface,
as the former already implements the evictionComparator().
Any EvictionInterface implementation must be Serializable, as it is part of the cache configuration, and any Configuration
must be Serializable as configurations must be able to be transferred over the network to remote instances.
| Modifier and Type | Method and Description |
|---|---|
void |
afterEviction()
Called each time after an eviction cycle has ended.
|
void |
beforeEviction()
Called each time before an eviction cycle is being started.
|
Comparator<? super HolderFreezer<K,V>> |
evictionComparator()
Returns the Comparator implementing the eviction policy.
|
long |
getFreezeValue(K key,
TCacheHolder<V> holder)
Returns a value that is required by the actual implementation for eviction.
|
Comparator<? super HolderFreezer<K,V>> evictionComparator()
long getFreezeValue(K key, TCacheHolder<V> holder)
TODO For v2.0: First, rename this to getSnapshot() as it is clearer. Secondly, we could allow snapshots to be objects, and then we would have "public interface EvictionInterface<K, V, SNAPSHOT>"
key - The key of the cache entryholder - The holder, which includes the value and metadatavoid beforeEviction()
void afterEviction()
Copyright © 2018 trivago. All rights reserved.