Interface CacheListener<K extends Serializable,V>

All Known Implementing Classes:
InvalidationExoCache, LoggingCacheListener

public interface CacheListener<K extends Serializable,V>
Created by The eXo Platform SAS
The cache listener allows to be aware of various events that occurs for a cache. For performance reason a listener must perform short time lived operations or should consider to perform jobs asynchronously.
  • Method Details

    • onExpire

      void onExpire(CacheListenerContext context, K key, V obj) throws Exception
      An entry is expired from the cache.
      Parameters:
      context - the listener context
      key - the entry key
      obj - the entry value
      Throws:
      Exception - any exception
    • onRemove

      void onRemove(CacheListenerContext context, K key, V obj) throws Exception
      An entry is removed from the cache.
      Parameters:
      context - the listener context
      key - the entry key
      obj - the entry value
      Throws:
      Exception - any exception
    • onPut

      void onPut(CacheListenerContext context, K key, V obj) throws Exception
      An entry is inserted in the cache.
      Parameters:
      context - the listener context
      key - the entry key
      obj - the entry value
      Throws:
      Exception - any exception
    • onPutLocal

      default void onPutLocal(CacheListenerContext context, K key, V obj) throws Exception
      An entry is inserted in the cache (local mode without replication).
      Parameters:
      context - the listener context
      key - the entry key
      obj - the entry value
      Throws:
      Exception - any exception
    • onGet

      void onGet(CacheListenerContext context, K key, V obj) throws Exception
      An entry is retrieved from the cache.
      Parameters:
      context - the listener context
      key - the entry key
      obj - the entry value
      Throws:
      Exception - any exception
    • onClearCache

      void onClearCache(CacheListenerContext context) throws Exception
      The cache is globally cleared.
      Parameters:
      context - the listener context
      Throws:
      Exception - any exception