Class CacheEntryAttributes

  • All Implemented Interfaces:
    Serializable, Cloneable, org.apache.commons.jcs3.engine.behavior.IElementAttributes

    public class CacheEntryAttributes
    extends org.apache.commons.jcs3.engine.ElementAttributes
    Class that contains attributes for JCS cache entries. Parameters are used to properly handle HTTP caching, and metadata structures, that should be stored together with the cache entry
    Since:
    8168
    See Also:
    Serialized Form
    • Constructor Detail

    • Method Detail

      • isNoTileAtZoom

        public boolean isNoTileAtZoom()
        Determines if the entry is marked as "no tile at this zoom level".
        Returns:
        if the entry is marked as "no tile at this zoom level"
      • setNoTileAtZoom

        public void setNoTileAtZoom​(boolean noTileAtZoom)
        Sets the marker for "no tile at this zoom level"
        Parameters:
        noTileAtZoom - true if this entry is "no tile at this zoom level"
      • getEtag

        public String getEtag()
        Returns ETag header value, that was returned for this entry.
        Returns:
        ETag header value, that was returned for this entry.
      • setEtag

        public void setEtag​(String etag)
        Sets the ETag header that was set with this entry
        Parameters:
        etag - Etag header
      • getLongAttr

        private long getLongAttr​(String key)
        Utility for conversion from String to int, with default to 0, in case of any errors
        Parameters:
        key - - integer as string
        Returns:
        int value of the string
      • getLastModification

        public long getLastModification()
        Returns last modification of the object in cache in milliseconds from Epoch.
        Returns:
        last modification of the object in cache in milliseconds from Epoch
      • setLastModification

        public void setLastModification​(long lastModification)
        sets last modification of the object in cache
        Parameters:
        lastModification - time in format of milliseconds from Epoch
      • getExpirationTime

        public long getExpirationTime()
        Returns when the object expires in milliseconds from Epoch.
        Returns:
        when the object expires in milliseconds from Epoch
      • setExpirationTime

        public void setExpirationTime​(long expirationTime)
        sets expiration time for the object in cache
        Parameters:
        expirationTime - in format of milliseconds from epoch
      • setResponseCode

        public void setResponseCode​(int responseCode)
        Sets the HTTP response code that was sent with the cache entry
        Parameters:
        responseCode - http status code
        Since:
        8389
      • getResponseCode

        public int getResponseCode()
        Returns HTTP response code.
        Returns:
        http status code
        Since:
        8389
      • setMetadata

        public void setMetadata​(Map<String,​String> map)
        Sets the metadata about cache entry. As it stores all data together, with other attributes in common map, some keys might not be stored.
        Parameters:
        map - metadata to save
        Since:
        8418
      • getMetadata

        public Map<String,​StringgetMetadata()
        Returns an unmodifiable Map containing all metadata. Unmodifiable prevents access to metadata within attributes.
        Returns:
        unmodifiable Map with cache element metadata
        Since:
        8418
      • getErrorMessage

        public String getErrorMessage()
        Returns error message returned while retrieving this object.
        Returns:
        error message returned while retrieving this object
      • setError

        public void setError​(Exception error)
        Sets error related to this object.
        Parameters:
        error - error related to this object
        Since:
        10469
      • setErrorMessage

        public void setErrorMessage​(String message)
        Sets error message related to this object.
        Parameters:
        message - error message related to this object
      • setException

        public void setException​(Exception e)
        Sets exception that caused error.
        Parameters:
        e - exception that caused error
      • getException

        public Optional<Class<? extends Exception>> getException()
        Returns optional exception that was thrown when fetching resource.
        Returns:
        Optional exception that was thrown when fetching resource