| Modifier and Type | Field and Description |
|---|---|
private long |
endVersion
End of valid range.
|
private int |
hashIndex
hash index of the key
|
private K |
key
identifier of the entry
|
(package private) int |
lruid
id of lru this cache entry lives on
|
private ExplicitList.Link<LRUCache.CacheEntry> |
lruLink
Used to put on lru list
|
(package private) boolean |
neverReplace
true if entry should not be replaced
|
private int |
numWaiters
Number of waiters waiting on state change
|
private long |
startVersion
Starting version for which entry is valid
|
private LRUCache.EntryState |
state
Current state
|
private java.util.concurrent.locks.Condition |
stateCondition
Used when waiting on being initialized entries
|
private V |
value
value of the entry
|
private ExplicitList.Link<LRUCache.CacheEntry> |
versionsLink
Used to build a sorted chain of versions with the most current entry at the head
|
| Constructor and Description |
|---|
CacheEntry(int lruid) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
anyWaiters() |
void |
bumpWaiters() |
boolean |
canReadFrom(long readVersion)
Checks if read for the given version can be satisfied
from the entry
|
void |
clearNeverReplace() |
void |
decrementWaiters() |
long |
getEndVersion() |
int |
getHashIndex() |
K |
getKey() |
LRUCache.LRU |
getLru() |
ExplicitList.Link<LRUCache.CacheEntry> |
getLruLink() |
long |
getStartVersion() |
LRUCache.EntryState |
getState() |
java.util.concurrent.locks.Condition |
getStateCondition(java.util.concurrent.locks.Lock lock) |
V |
getValue() |
ExplicitList.Link<LRUCache.CacheEntry> |
getVersionsLink() |
void |
initialize(K key)
inits the fields..used after a cache entry is replaced
|
boolean |
isCurrentVersion()
Check if entry is the most recent version for its key
|
boolean |
isEntryFreeable() |
boolean |
isNeverReplace() |
void |
setAsCurrentVersion(V newValue,
long startVersion) |
void |
setAsSnapshotVersion(long newEndVersion) |
void |
setNeverReplace() |
void |
setState(LRUCache.EntryState newState) |
java.lang.String |
toString() |
private K key
private V value
private long startVersion
private long endVersion
private int hashIndex
private java.util.concurrent.locks.Condition stateCondition
private int numWaiters
private LRUCache.EntryState state
private ExplicitList.Link<LRUCache.CacheEntry> versionsLink
private ExplicitList.Link<LRUCache.CacheEntry> lruLink
int lruid
boolean neverReplace
public void initialize(K key)
key - new identifier for the entrypublic void setNeverReplace()
public void clearNeverReplace()
public boolean isNeverReplace()
public K getKey()
public V getValue()
public int getHashIndex()
public LRUCache.LRU getLru()
public java.util.concurrent.locks.Condition getStateCondition(java.util.concurrent.locks.Lock lock)
public void bumpWaiters()
public void decrementWaiters()
public boolean anyWaiters()
public long getEndVersion()
public long getStartVersion()
public boolean isCurrentVersion()
public boolean canReadFrom(long readVersion)
readVersion - public LRUCache.EntryState getState()
public void setState(LRUCache.EntryState newState)
public ExplicitList.Link<LRUCache.CacheEntry> getVersionsLink()
public ExplicitList.Link<LRUCache.CacheEntry> getLruLink()
public void setAsCurrentVersion(V newValue, long startVersion)
public void setAsSnapshotVersion(long newEndVersion)
public boolean isEntryFreeable()
public java.lang.String toString()
toString in class java.lang.Object