Package io.github.xanthic.cache.api
Interface RemovalListener<K,V>
- Type Parameters:
K- the type of keys that form the cacheV- the type of values that are contained in the cache
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Listens to entry removals in the cache that may occur for various reasons.
-
Method Summary
Modifier and TypeMethodDescriptionvoidonRemoval(K key, V value, RemovalCause cause) Called when an entry is removed.
-
Method Details
-
onRemoval
Called when an entry is removed.No guarantee is made whether this is executed synchronously or asynchronously.
For optimal compatibility across backing implementations, prefer using
RemovalCause.isEviction()to checking against specific states.- Parameters:
key- the key whose mapping was removed or updatedvalue- the mapped value that was removedcause- the reason for the removal
-