Class CacheEntry
java.lang.Object
org.pipservices3.components.cache.CacheEntry
public class CacheEntry extends Object
Data object to store cached values with their keys used by
MemoryCache-
Constructor Summary
Constructors Constructor Description CacheEntry(String key, Object value, long timeout)Creates a new instance of the cache entry and assigns its values. -
Method Summary
Modifier and Type Method Description longgetExpiration()Gets the expiration timeout.StringgetKey()Gets the key to locate the cached value.ObjectgetValue()Gets the cached value.booleanisExpired()Checks if this value already expired.voidsetValue(Object value, long timeout)Sets a new value and extends its expiration.
-
Constructor Details
-
CacheEntry
Creates a new instance of the cache entry and assigns its values.- Parameters:
key- a unique key to locate the value.value- a value to be stored.timeout- expiration timeout in milliseconds.
-
-
Method Details
-
getKey
Gets the key to locate the cached value.- Returns:
- the value key.
-
getValue
Gets the cached value.- Returns:
- the value object.
-
setValue
Sets a new value and extends its expiration.- Parameters:
value- a new cached value.timeout- a expiration timeout in milliseconds.
-
getExpiration
public long getExpiration()Gets the expiration timeout.- Returns:
- the expiration timeout in milliseconds.
-
isExpired
public boolean isExpired()Checks if this value already expired.- Returns:
- true if the value already expires and false otherwise.
-