Package org.alfresco.util
Class ExpiringValueCache<T>
- java.lang.Object
-
- org.alfresco.util.ExpiringValueCache<T>
-
- All Implemented Interfaces:
Serializable
public class ExpiringValueCache<T> extends Object implements 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExpiringValueCache()
Default constructor.ExpiringValueCache(long timeout)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear the cache valueT
get()
Get the cached object.void
put(T value)
Put a value into the cache.
-
-
-
Method Detail
-
put
public void put(T value)
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
public T 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
-
-