Package com.easydesk.cache
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
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCachedObject(T object) Creates an entry that expires in the default time (30 minutes).CachedObject(T object, long expires) -
Method Summary
Modifier and TypeMethodDescriptionlonglongbooleanisStale()voidsetExpires(long expires) voidsetStale(boolean stale)
-
Field Details
-
DEFAULT
public static final int DEFAULTCache the object with the Default TTL- See Also:
-
FOREVER
public static final int FOREVERDo not expire the object- See Also:
-
created
protected long created
-
-
Constructor Details
-
CachedObject
Creates an entry that expires in the default time (30 minutes).- Parameters:
object- the object you want to cache
-
CachedObject
- Parameters:
object- the object to cacheexpires- how long before the object expires, in ms (e.g. 1000 = 1 second)
-
-
Method Details
-
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()
-