public class Entry<E extends Entry,K,T> extends Object implements MutableCacheEntry<K,T>, StorageEntry
| Modifier and Type | Field and Description |
|---|---|
Entry<E,K,T> |
another
Hash implementation: Link to another entry in the same hash table slot when the hash code collides.
|
long |
fetchedTime
Time the entry was last updated by put or by fetching it from the cache source.
|
int |
hashCode
Hash implementation: the calculated, modified hash code, retrieved from the key when the entry is
inserted in the cache
|
K |
key |
E |
next
Lru list: pointer to next element or list head
|
long |
nextRefreshTime
Contains the next time a refresh has to occur.
|
E |
prev
Lru list: pointer to previous element or list head
|
BaseCache.MyTimerTask |
task |
T |
value |
| Constructor and Description |
|---|
Entry() |
| Modifier and Type | Method and Description |
|---|---|
void |
ensureFetchAbort(boolean _finished)
If fetch is not stopped, abort and make entry invalid.
|
boolean |
equals(Object obj)
Cache entries always have the object identity as equals method.
|
void |
finishFetch(long _nextRefreshTime) |
long |
getCreatedOrUpdated()
Used for the storage interface.
|
long |
getEntryExpiryTime()
Used for the storage interface.
|
Throwable |
getException() |
K |
getKey()
Key of the stored entry
|
long |
getLastModification() |
T |
getValue() |
long |
getValueExpiryTime()
Expiry time or 0.
|
Object |
getValueOrException()
Used for the storage interface.
|
boolean |
hasException() |
boolean |
hasFreshData()
Returns true if the entry has a valid value and is fresh / not expired.
|
boolean |
hasFreshData(long now)
Same as
hasFreshData(), optimization if current time is known. |
boolean |
hasFreshData(long now,
long _nextRefreshTime) |
boolean |
isBeeingReput() |
boolean |
isDataValidState()
The entry value was fetched and is valid, which means it can be
returned by the cache.
|
boolean |
isDirty()
Memory entry needs to be send to the storage.
|
boolean |
isExpiredState()
The entry expired, but still in the cache.
|
boolean |
isFetchInProgress() |
boolean |
isFetchNextTimeState() |
boolean |
isGettingRefresh() |
boolean |
isLoadedNonValid() |
boolean |
isLoadedNonValidAndFetch() |
boolean |
isPinned()
Entry is not allowed to be evicted
|
boolean |
isRemovedFromReplacementList()
Check that this entry is removed from the list, may be used in assertions.
|
boolean |
isRemovedState() |
boolean |
isStale() |
boolean |
isVirgin() |
boolean |
needsTimeCheck() |
void |
removedFromList()
Reset next as a marker for
isRemovedFromReplacementList() |
void |
resetDirty() |
void |
setException(Throwable exception) |
void |
setExpiredState()
Entry is kept in the cache but has expired
|
void |
setGettingRefresh() |
void |
setLastModification(long t) |
void |
setLastModificationFromStorage(long t) |
void |
setLoadedNonValidAndFetch() |
void |
setRemovedState() |
void |
setStale() |
void |
setValue(T v) |
E |
shortCircuit() |
void |
startFetch()
Starts long operation on entry.
|
String |
toString() |
void |
waitForFetch() |
public BaseCache.MyTimerTask task
public long fetchedTime
public volatile long nextRefreshTime
public int hashCode
BaseCache.modifiedHash(int)public Entry<E extends Entry,K,T> another
public Entry()
public void setLastModification(long t)
public boolean isDirty()
public void setLastModificationFromStorage(long t)
public void resetDirty()
public final void removedFromList()
isRemovedFromReplacementList()public boolean isRemovedFromReplacementList()
public E shortCircuit()
public final boolean isVirgin()
public final boolean isFetchNextTimeState()
public final boolean isDataValidState()
public void startFetch()
public void finishFetch(long _nextRefreshTime)
public void ensureFetchAbort(boolean _finished)
public boolean isPinned()
public boolean isFetchInProgress()
public void waitForFetch()
public final boolean hasFreshData()
public final boolean hasFreshData(long now)
hasFreshData(), optimization if current time is known.public final boolean hasFreshData(long now, long _nextRefreshTime)
public boolean isLoadedNonValid()
public void setLoadedNonValidAndFetch()
public boolean isLoadedNonValidAndFetch()
public void setExpiredState()
public boolean isExpiredState()
BaseCache.hasKeepAfterExpired() is true.public void setRemovedState()
public boolean isRemovedState()
public void setGettingRefresh()
public boolean isGettingRefresh()
public boolean isBeeingReput()
public boolean needsTimeCheck()
public boolean isStale()
public void setStale()
public boolean hasException()
public Throwable getException()
getException in interface CacheEntry<K,T>public void setException(Throwable exception)
setException in interface MutableCacheEntry<K,T>public K getKey()
StorageEntrygetKey in interface CacheEntry<K,T>getKey in interface StorageEntrypublic long getLastModification()
getLastModification in interface CacheEntry<K,T>public long getValueExpiryTime()
getValueExpiryTime in interface StorageEntrypublic Object getValueOrException()
getValueOrException in interface StorageEntryStorageEntrypublic long getCreatedOrUpdated()
getCreatedOrUpdated in interface StorageEntryStorageEntrypublic long getEntryExpiryTime()
getEntryExpiryTime in interface StorageEntryStorageEntrycache2k API documentation. Copyright © 2000–2015 headissue GmbH, Munich.