Interface RemovalListener<K,V>

Type Parameters:
K - the type of keys that form the cache
V - 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.

@FunctionalInterface public interface RemovalListener<K,V>
Listens to entry removals in the cache that may occur for various reasons.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onRemoval(K key, V value, RemovalCause cause)
    Called when an entry is removed.
  • Method Details

    • onRemoval

      void onRemoval(K key, V value, RemovalCause cause)
      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 updated
      value - the mapped value that was removed
      cause - the reason for the removal