public class RICachedValue extends Object
RICache.
The actual value passed to the Cache is represented in an internal format,
generated by passing the value through an RIInternalConverter.
RICachedValues additionally store and provide meta information about
Cache Entry Values, including information for dealing with expiry.RIInternalConverter| Constructor and Description |
|---|
RICachedValue(Object internalValue,
long creationTime,
long expiryTime)
Constructs an
RICachedValue with the creation, access and
modification times being the current time. |
| Modifier and Type | Method and Description |
|---|---|
Object |
get()
Gets the internal value (without updating the access time).
|
long |
getAccessCount()
Gets the number of times the internal value has been accessed.
|
long |
getAccessTime()
Gets the time (since the Epoc) in milliseconds since the internal value
was last accessed.
|
long |
getCreationTime()
Gets the time (since the Epoc) in milliseconds since the internal value
was created.
|
long |
getExpiryTime()
Gets the time (since the Epoc) in milliseconds when the Cache Entry
associated with this value should be considered expired.
|
Object |
getInternalValue(long accessTime)
Gets the internal value with the side-effect of updating the access time
to that which is specified and incrementing the access count.
|
long |
getModificationCount()
Gets the number of times the internal value has been modified (set)
|
long |
getModificationTime()
Gets the time (since the Epoc) in milliseconds since the internal value
was last modified.
|
boolean |
isExpiredAt(long now)
Determines if the Cache Entry associated with this value would be expired
at the specified time
|
void |
set(Object internalValue)
Sets the internal value (without updating the modification time)
|
void |
setExpiryTime(long expiryTime)
Sets the time (since the Epoc) in milliseconds when the Cache Entry
associated with this value should be considered expired.
|
void |
setInternalValue(Object internalValue,
long modificationTime)
Sets the internal value with the additional side-effect of updating the
modification time to that which is specified and incrementing the
modification count.
|
public RICachedValue(Object internalValue, long creationTime, long expiryTime)
RICachedValue with the creation, access and
modification times being the current time.internalValue - the internal representation of the valuecreationTime - the time when the cache entry was createdexpiryTime - the time when the cache entry should expirepublic long getCreationTime()
public long getAccessTime()
public long getAccessCount()
public long getModificationTime()
public long getModificationCount()
public long getExpiryTime()
public void setExpiryTime(long expiryTime)
expiryTime - time in milliseconds (since the Epoc)public boolean isExpiredAt(long now)
now - time in milliseconds (since the Epoc)public Object get()
public void set(Object internalValue)
internalValue - the new internal valuepublic Object getInternalValue(long accessTime)
accessTime - the time when the internal value was accessedpublic void setInternalValue(Object internalValue, long modificationTime)
internalValue - the new internal valuemodificationTime - the time when the value was modifiedCopyright © 2019. All rights reserved.