Interface CacheLIRS.EvictionCallback<K,​V>

  • Type Parameters:
    K - type of the key
    V - type of the value
    Enclosing class:

    public static interface CacheLIRS.EvictionCallback<K,​V>
    Listener for items that are evicted from the cache. The listener is called for both, resident and non-resident items. In the latter case the passed value is null.
    • Method Detail

      • evicted

        void evicted​(@NotNull
                     K key,
                     V value,
                     @NotNull RemovalCause cause)
        Indicates eviction of an item.

        Note: It is not safe to call any of CacheLIRS's method from withing this callback. Any such call might result in undefined behaviour and Java level deadlocks.

        The method may be called twice for the same key (first if the entry is resident, and later if the entry is non-resident).

        key - the evicted item's key
        value - the evicted item's value or null if non-resident
        cause - the cause of the eviction