Package org.alfresco.util
Class ExpiringValueCache<T>
java.lang.Object
org.alfresco.util.ExpiringValueCache<T>
- All Implemented Interfaces:
Serializable
Simple cache of a single Object value.
The object placed in the cache will automatically be discarded after a timeout value.
- Author:
- Kevin Roast
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ExpiringValueCache
public ExpiringValueCache()Default constructor. Uses the default timeout of 1 minute. -
ExpiringValueCache
public ExpiringValueCache(long timeout) Constructor- Parameters:
timeout
- Timeout in milliseconds before cached value is discarded
-
-
Method Details
-
put
Put a value into the cache. The item will be return from the associated get() method until the timeout expires then null will be returned.- Parameters:
value
- The object to store in the cache
-
get
Get the cached object. The set item will be returned until it expires, then null will be returned.- Returns:
- cached object or null if not set or expired.
-
clear
public void clear()Clear the cache value
-