public interface CacheEntry<K,V>
null
or contains an exception. Entries can be retrieved by
Cache.peekEntry(Object)
or Cache.getEntry(Object)
or
via iterated via Cache.entries()
.
After retrieved, the entry instance does not change its values, even if the value for its key is updated in the cache.
Design note: The cache is generally also aware of the time the object will be refreshed next or when it will expire. This is not exposed to applications by intention.
Cache.peekEntry(Object)
,
Cache.getEntry(Object)
,
Cache.entries()
Modifier and Type | Method and Description |
---|---|
Throwable |
getException()
The exception happened when the value was loaded and
the exception could not be suppressed.
|
K |
getKey()
Key associated with this entry.
|
long |
getLastModification()
Deprecated.
permanently not supported any more, you may use
MutableCacheEntry.getRefreshedTime() |
V |
getValue()
Value of the entry.
|
K getKey()
V getValue()
null
if permitted for this cache
via Cache2kBuilder.permitNullValues(boolean)
. If the
entry had a loader exception which is not suppressed, this exception will be
propagated. This can be customized with
Cache2kBuilder.exceptionPropagator(ExceptionPropagator)
CacheLoaderException
- if the loading produced an exceptionThrowable getException()
null
if no exception
happened or it was suppressed. If null
then getValue()
returns a value and does not throw an exception.long getLastModification()
MutableCacheEntry.getRefreshedTime()
UnsupportedOperationException
.
Functionality was present in version 1.0, but was removed
for version 1.2. To access the last modification time it is possible to
use MutableCacheEntry.getRefreshedTime()
More rationale see GH#84. The method is planed to be removed for version 2.0.
AbstractCacheEntry
can be used for implementations of this class to avoid implementing this method.
UnsupportedOperationException
- always throwncache2k API documentation. Copyright © 2000–2018 headissue GmbH, Munich.