@Immutable public class CacheEntry<K,V> extends AbstractMap.SimpleEntry<K,V>
| Constructor and Description |
|---|
CacheEntry(K key,
V value)
Constructs a new cache entry.
|
CacheEntry(K key,
V value,
long cachePeriodMillis)
Constructs a new cache entry.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getCachePeriodMillis()
Returns the cache period in milliseconds.
|
long |
getStartTimeMillis()
Returns the time of cache entry creation.
|
boolean |
isObsolete()
Returns
true if and only if the cache period has elapsed. |
V |
map(K key)
Maps the given key to the value of this cache entry if it
matches or otherwise returns
null. |
boolean |
matches(K key)
|
equals, getKey, getValue, hashCode, setValue, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcomparingByKey, comparingByKey, comparingByValue, comparingByValuepublic CacheEntry(@CheckForNull K key, @CheckForNull V value)
Long.MAX_VALUE as its timeout.key - the key.value - the value.public CacheEntry(@CheckForNull K key, @CheckForNull V value, long cachePeriodMillis)
key - the key.value - the value.cachePeriodMillis - the cache period of this entry in milliseconds.public long getCachePeriodMillis()
public long getStartTimeMillis()
public boolean isObsolete()
true if and only if the cache period has elapsed.@CheckForNull public V map(@CheckForNull K key)
null.public boolean matches(@CheckForNull K key)
true if and only if the given key
equals the key of this cache entry and this
cache entry is not obsolete.key - the key to test.Copyright © 2005–2017 Schlichtherle IT Services. All rights reserved.