|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.grails.web.util.CacheEntry
public class CacheEntry extends java.lang.Object
Wrapper for a value inside a cache that adds timestamp information for expiration and prevents "cache storms" with a Lock. JMM happens-before is ensured with AtomicReference. Objects in cache are assumed to not change after publication.
Field Summary | |
---|---|
protected long |
createdMillis
|
protected java.util.concurrent.atomic.AtomicReference |
valueRef
|
protected java.util.concurrent.locks.Lock |
writeLock
|
Constructor Summary | |
CacheEntry(java.lang.Object value)
|
Method Summary | |
---|---|
void
|
expire()
|
long
|
getCreatedMillis()
|
java.lang.Object
|
getValue(long timeout, java.security.PrivilegedAction updater)
gets the current value from the entry and updates it if it's older than timeout |
java.lang.Object
|
getValue()
|
protected boolean
|
hasExpired(long timeout)
|
protected void
|
resetTimestamp()
|
protected boolean
|
shouldUpdate(long beforeLockingCreatedMillis)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected long createdMillis
protected java.util.concurrent.atomic.AtomicReference valueRef
protected java.util.concurrent.locks.Lock writeLock
Constructor Detail |
---|
public CacheEntry(java.lang.Object value)
Method Detail |
---|
public void expire()
public long getCreatedMillis()
public java.lang.Object getValue(long timeout, java.security.PrivilegedAction updater)
public java.lang.Object getValue()
protected boolean hasExpired(long timeout)
protected void resetTimestamp()
protected boolean shouldUpdate(long beforeLockingCreatedMillis)
Groovy Documentation