Package org.opencms.util
Class CmsExpiringValue<T>
java.lang.Object
org.opencms.util.CmsExpiringValue<T>
- Type Parameters:
T
- the type of the cached value
Simple utility class for caching a single value with a given cache expiration time.
If the time between the last write operation and a read operation is longer than the expiration time, null will be returned from the read operation.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
CmsExpiringValue
Creates a new instance.- Parameters:
expirationTime
- the expiration time in milliseconds
-
-
Method Details
-
get
Gets the cached value.Returns null if the last update was longer ago than the expiration time.
- Returns:
- the cached value
-
set
Sets the cached value.- Parameters:
value
- the cached value
-