Class Cache

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Cache()  
    • Constructor Detail

      • Cache

        protected Cache()
    • Method Detail

      • setExpirationPolicy

        public void setExpirationPolicy​(ExpirationPolicy expirationPolicy)
        Sets the active ExpirationPolicy.
        Parameters:
        expirationPolicy - An ExpirationPolicy, not null
      • contains

        public abstract boolean contains​(java.lang.String cacheEntryName)
        Checks if the cache contains an entry with the given name.
        Parameters:
        cacheEntryName - An entry name
        Returns:
        true if the cache contains this entry
      • load

        public abstract java.io.InputStream load​(java.lang.String cacheEntryName)
        Loads the specified entry from the cache and returns an InputStream to be read from. Returns null if the cache does not contain the specified cacheEntryName.
        Parameters:
        cacheEntryName - An entry name
        Returns:
        an InputStream or null
      • remove

        public abstract void remove​(java.lang.String cacheEntryName)
        Removes the specified entry from the cache if available. Does nothing if no such entry is available.
        Parameters:
        cacheEntryName - An entry name
      • store

        public abstract void store​(java.lang.String cacheEntryName,
                                   java.io.InputStream inputStream,
                                   long expirationDate)
        Stores a request in the cache.
        Parameters:
        cacheEntryName - The entry name to be stored to
        inputStream - An InputStream containing the data to be cached
        expirationDate - The date of expiration represented in milliseconds since 1.1.1970
      • isExpired

        public abstract boolean isExpired​(java.lang.String cacheEntryName)
        Checks if the specified entry is expired.
        Parameters:
        cacheEntryName - An entry name
        Returns:
        true if the entry is expired
      • clear

        public abstract void clear()
        Clears the cache by effectively removing all cached data.
      • createCacheEntryName

        public static java.lang.String createCacheEntryName​(java.lang.String method,
                                                            java.util.Map<java.lang.String,​java.lang.String> params)
        Creates a unique entry name string for a request. It consists of the method name and all the parameter names and values concatenated in alphabetical order. It is used to identify cache entries in the backend storage. If hashCacheEntryNames is set to true this method will return a MD5 hash of the generated name.
        Parameters:
        method - The request method
        params - The request parameters
        Returns:
        a cache entry name