public class CacheEntry<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected long |
createdMillis |
protected java.util.concurrent.atomic.AtomicReference<T> |
valueRef |
protected java.util.concurrent.locks.Lock |
writeLock |
| Constructor and Description |
|---|
CacheEntry(T value) |
| Modifier and Type | Method and Description |
|---|---|
void |
expire() |
long |
getCreatedMillis() |
T |
getValue() |
T |
getValue(long timeout,
java.security.PrivilegedAction<T> updater)
gets the current value from the entry and updates it if it's older than timeout
updater is a callback for creating an updated value.
|
protected boolean |
hasExpired(long timeout) |
protected void |
resetTimestamp() |
protected boolean |
shouldUpdate(long beforeLockingCreatedMillis) |
protected java.util.concurrent.atomic.AtomicReference<T> valueRef
protected long createdMillis
protected java.util.concurrent.locks.Lock writeLock
public CacheEntry(T value)
public T getValue(long timeout, java.security.PrivilegedAction<T> updater)
timeout - updater - public T getValue()
protected boolean hasExpired(long timeout)
protected boolean shouldUpdate(long beforeLockingCreatedMillis)
protected void resetTimestamp()
public long getCreatedMillis()
public void expire()