Interface MemoryCache.CacheListener

  • Enclosing interface:
    MemoryCache

    public static interface MemoryCache.CacheListener
    Provides the interface for cache clients to be notified of key events. Currently the only key event is the removal of an entry from the cache. A client may need to know a removal instigated by the cache occurred in order to adjust its own state or to free resources associated with the removed entry.
    • Method Detail

      • entryRemoved

        void entryRemoved​(java.lang.Object key,
                          java.lang.Object clientObject)
        Called just after an entry has been removed from the cache. Listeners should deallocate any resources that won't be deallocated by normal garbage collection.
        Parameters:
        key - the entry's cache key.
        clientObject - the cached object.
      • removalException

        void removalException​(java.lang.Throwable exception,
                              java.lang.Object key,
                              java.lang.Object clientObject)
        Called when an exception occurs within the entryRemoved(Object, Object) call.
        Parameters:
        exception - the exception that occurred.
        key - the entry's cache key.
        clientObject - the cached object.