Class CacheEntry

java.lang.Object
org.omnifaces.util.cache.CacheEntry
All Implemented Interfaces:
Serializable

public class CacheEntry extends Object implements Serializable
Meta data for a value that's stored in a cache. Can be used for cache implementations that don't support both validity and attributes natively. Cache implementations are not required to use this type.

Since OmniFaces 3.0 the Object value and Map<String, Object> attributes have been reworked to Serializable value and Map<String, Serializable> attributes in order to explicitly set the expected type.

Since:
1.1
Author:
Arjan Tijms
See Also:
  • Constructor Details

  • Method Details

    • getValue

      public Serializable getValue()
      Returns the value for which this object is keeping meta data
      Returns:
      The value for which meta data is kept
    • setValue

      public void setValue(Serializable value)
      Sets the value for which this object is keeping meta data
      Parameters:
      value - The value for which meta data is kept
    • getValidTill

      public Date getValidTill()
      Returns the date that's the last moment in time the value obtained via getValue() is valid. After that moment, the value should not be used.
      Returns:
      date indicating last moment value hold by this object is valid.
    • setValidTill

      public void setValidTill(Date validTill)
      Sets the date that's the last moment in time the value obtained via getValue() is valid. After that moment, the value should not be used.
      Parameters:
      validTill - date indicating last moment value hold by this object is valid.
      Since:
      1.2
    • isValid

      public boolean isValid()
      Returns whether this entry holds a valid value. If false is returned, the value should not be used and the cache implementation should try to remove this entry and its associated value from the cache.
      Returns:
      true if this entry is still valid, false otherwise.
    • getAttributes

      public Map<String,Serializable> getAttributes()
      Gets a map of attributes associated with this entry.

      Attributes are general key,value pairs, that are currently mainly used to store the result of EL expressions that appear in the rendering represented by the main value this entry represents.

      Returns:
      a map of attributes associated with this entry.
      Since:
      1.2