Class CacheWrapper

java.lang.Object
org.nuxeo.ecm.core.cache.CacheWrapper
All Implemented Interfaces:
Cache, CacheManagement
Direct Known Subclasses:
CacheAttributesChecker, CacheInvalidator, CacheMetrics

public class CacheWrapper extends Object implements CacheManagement
Since:
9.1
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Description copied from interface: Cache
      Get cache name as specified in the descriptor
      Specified by:
      getName in interface Cache
      Returns:
      the cache name
    • get

      public Serializable get(String key)
      Description copied from interface: Cache
      Get method to retrieve value from cache Must not raise exception if the key is null, but return null
      Specified by:
      get in interface Cache
      Parameters:
      key - the string key
      Returns:
      the Serializable value, return null if the key does not exist or if the key is null
    • keySet

      public Set<String> keySet()
      Description copied from interface: Cache
      Returns the set of all keys stored in the cache.
      Specified by:
      keySet in interface Cache
      Returns:
      the Set of all keys
    • invalidateLocal

      public void invalidateLocal(String key)
      Description copied from interface: CacheManagement
      Invalidates the given key locally. Does not propagate invalidations.
      Specified by:
      invalidateLocal in interface CacheManagement
      Parameters:
      key - the key to remove from the cache
    • invalidate

      public void invalidate(String key)
      Description copied from interface: Cache
      Invalidate the given key
      Specified by:
      invalidate in interface Cache
      Parameters:
      key - , the key to remove from the cache, if null will do nothing
    • invalidateLocalAll

      public void invalidateLocalAll()
      Description copied from interface: CacheManagement
      Invalidates all keys locally. Does not propagate invalidations.
      Specified by:
      invalidateLocalAll in interface CacheManagement
    • invalidateAll

      public void invalidateAll()
      Description copied from interface: Cache
      Invalidate all key-value stored in the cache
      Specified by:
      invalidateAll in interface Cache
    • putLocal

      public void putLocal(String key, Serializable value)
      Description copied from interface: CacheManagement
      Stores a Serializable value into the cache locally. Does not propagate invalidations.
      Specified by:
      putLocal in interface CacheManagement
      Parameters:
      key - the key
      value - the value
    • put

      public void put(String key, Serializable value)
      Description copied from interface: Cache
      Put method to store a Serializable value
      Specified by:
      put in interface Cache
      Parameters:
      key - the string key, if null, the value will not be stored
      value - the value to store, if null, the value will not be stored
    • hasEntry

      public boolean hasEntry(String key)
      Description copied from interface: Cache
      Check if a given key is present inside the cache. Compared to the get() method, this method must not update internal cache state and change TTL
      Specified by:
      hasEntry in interface Cache
      Parameters:
      key - the string key
      Returns:
      true if a corresponding entry exists, false otherwise
    • start

      public void start()
      Description copied from interface: CacheManagement
      Starts this cache.
      Specified by:
      start in interface CacheManagement
    • stop

      public void stop()
      Description copied from interface: CacheManagement
      Stops this cache and releases related resources.
      Specified by:
      stop in interface CacheManagement
    • getSize

      public long getSize()
      Description copied from interface: CacheManagement
      Returns this cache size (approximate number of entries), or -1 if the number of entries is unknown or too expensive to compute.
      Specified by:
      getSize in interface CacheManagement
      Returns:
      the approximate number of entries, or -1
    • toString

      public String toString()
      Overrides:
      toString in class Object