Class CacheAttributesChecker

  • All Implemented Interfaces:
    Cache, CacheManagement

    public class CacheAttributesChecker
    extends CacheWrapper
    Class to implement mandatory check attributes before calling implementation of cache This enable to have the same behavior for any use of cache for all implementation of cache
    Since:
    6.0
    • Method Detail

      • 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
        Overrides:
        get in class CacheWrapper
        Parameters:
        key - the string key
        Returns:
        the Serializable value, return null if the key does not exist or if the key is null
      • invalidate

        public void invalidate​(String key)
        Description copied from interface: Cache
        Invalidate the given key
        Specified by:
        invalidate in interface Cache
        Overrides:
        invalidate in class CacheWrapper
        Parameters:
        key - , the key to remove from the cache, if null will do nothing
      • 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
        Overrides:
        put in class CacheWrapper
        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
        Overrides:
        hasEntry in class CacheWrapper
        Parameters:
        key - the string key
        Returns:
        true if a corresponding entry exists, false otherwise
      • 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
        Overrides:
        getSize in class CacheWrapper
        Returns:
        the approximate number of entries, or -1