Class CachedObject<T>

java.lang.Object
com.easydesk.cache.CachedObject<T>
Type Parameters:
T - the type of the wrapped object
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
RefreshableCachedObject

public class CachedObject<T> extends Object implements Serializable
Wrapper for an object you want to store in a cache for a period of time.

Ported unchanged (aside from package) from Apache Fulcrum's org.apache.fulcrum.cache.CachedObject

See Also:
  • Field Details

    • DEFAULT

      public static final int DEFAULT
      Cache the object with the Default TTL
      See Also:
    • FOREVER

      public static final int FOREVER
      Do not expire the object
      See Also:
    • created

      protected long created
  • Constructor Details

    • CachedObject

      public CachedObject(T object)
      Creates an entry that expires in the default time (30 minutes).
      Parameters:
      object - the object you want to cache
    • CachedObject

      public CachedObject(T object, long expires)
      Parameters:
      object - the object to cache
      expires - how long before the object expires, in ms (e.g. 1000 = 1 second)
  • Method Details

    • getContents

      public T getContents()
    • getCreated

      public long getCreated()
    • getExpires

      public long getExpires()
    • setExpires

      public void setExpires(long expires)
    • setStale

      public void setStale(boolean stale)
    • isStale

      public boolean isStale()