Interface CacheEntryEvent<K,V>


@PublicApi public interface CacheEntryEvent<K,V>
A cache event.

NOTE: Although Cache does not support null as a valid value we are using it in getValue and getOldValue as a way to represent missing value. We have the following reasons for this:

  • Firstly, some events inherently do not have value or old value. For instance addition does not have an old value as the corresponding element was just added to the cache
  • Secondly, in some implementations the information for the value and/or old value is not available at all.
  • Thirdly, the listener can be added as a valueless listener
Since:
2.4
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the key the event was fired for
    Returns the old value for this key
    Returns the current value for this key
  • Method Details

    • getKey

      @Nonnull K getKey()
      Returns the key the event was fired for
      Returns:
      the key
    • getValue

      @Nullable V getValue()
      Returns the current value for this key
      Returns:
      the value. For details why is this method marked as Nullable please refer to the class level documentation
    • getOldValue

      @Nullable V getOldValue()
      Returns the old value for this key
      Returns:
      the old value. For details why is this method marked as Nullable please refer to the class level documentation