Class LocalCacheValue
java.lang.Object
com.tangosol.coherence.jcache.localcache.LocalCacheValue
Represents the internal Cache Entry Value with in an
LocalCache
.
The actual value passed to the Cache is represented in an internal format,
generated by passing the value through an InternalConverter
.
LocalCacheValue
s additionally store and provide meta information about
Cache Entry Values, including information for dealing with expiry.
- Since:
- Coherence 12.1.3
- Author:
- bo 2013.12.19
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Synthetic Update -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accessInternalValue
(long ldtAccess, javax.cache.expiry.ExpiryPolicy policy) Access valuestatic LocalCacheValue
createLoadedLocalCacheValue
(Object internalValue, long ldtCreation, javax.cache.expiry.ExpiryPolicy policy) Create a LocalCacheValue marked with Synthetic marker that it was loaded.static LocalCacheValue
createLocalCacheValue
(Object internalValue, long ldtCreation, javax.cache.expiry.ExpiryPolicy policy) Create a LocalCacheValue for an LocalCache entry.get()
Gets the internal value (without updating the access time).long
Gets the number of times the internal value has been accessed.long
Gets the time (since the Epoc) in milliseconds since the internal value was last accessed.long
Gets the time (since the Epoc) in milliseconds since the internal value was created.long
Gets the time (since the Epoc) in milliseconds when the Cache Entry associated with this value should be considered expired.Access internal value without updating access expiry.getInternalValue
(long ldtAccess) Gets the internal value with the side-effect of updating the access time to that which is specified and incrementing the access count.long
Gets the number of times the internal value has been modified (set)long
Gets the time (since the Epoc) in milliseconds since the internal value was last modified.boolean
isExpiredAt
(long ldtNow) Determines if the Cache Entry associated with this value would be expired at the specified timeboolean
isLoaded()
Determine if last update to this LocalValue was a load from an external resource.boolean
determine if last update was considered syntheticvoid
Sets the internal value (without updating the modification time)void
setExpiryTime
(long ldtExpiry) Sets the time (since the Epoc) in milliseconds when the Cache Entry associated with this value should be considered expired.updateInternalValue
(Object internalValue, long ldtModification, javax.cache.expiry.ExpiryPolicy policy) Sets the internal value with the additional side-effect of updating the modification time to that which is specified and incrementing the modification count.
-
Constructor Details
-
LocalCacheValue
Copy constructor- Parameters:
oldValue
- the old local cache value
-
-
Method Details
-
getCreationTime
public long getCreationTime()Gets the time (since the Epoc) in milliseconds since the internal value was created.- Returns:
- time in milliseconds (since the Epoc)
-
getAccessTime
public long getAccessTime()Gets the time (since the Epoc) in milliseconds since the internal value was last accessed.- Returns:
- time in milliseconds (since the Epoc)
-
getAccessCount
public long getAccessCount()Gets the number of times the internal value has been accessed.- Returns:
- the access count
-
getModificationTime
public long getModificationTime()Gets the time (since the Epoc) in milliseconds since the internal value was last modified.- Returns:
- time in milliseconds (since the Epoc)
-
getModificationCount
public long getModificationCount()Gets the number of times the internal value has been modified (set)- Returns:
- the modification count
-
getExpiryTime
public long getExpiryTime()Gets the time (since the Epoc) in milliseconds when the Cache Entry associated with this value should be considered expired.- Returns:
- time in milliseconds (since the Epoc)
-
setExpiryTime
public void setExpiryTime(long ldtExpiry) Sets the time (since the Epoc) in milliseconds when the Cache Entry associated with this value should be considered expired.- Parameters:
ldtExpiry
- time in milliseconds (since the Epoc)
-
isExpiredAt
public boolean isExpiredAt(long ldtNow) Determines if the Cache Entry associated with this value would be expired at the specified time- Parameters:
ldtNow
- time in milliseconds (since the Epoc)- Returns:
- true if the value would be expired at the specified time
-
get
Gets the internal value (without updating the access time).- Returns:
- the internal value
-
set
Sets the internal value (without updating the modification time)- Parameters:
internalValue
- the new internal value
-
getInternalValue
Gets the internal value with the side-effect of updating the access time to that which is specified and incrementing the access count.- Parameters:
ldtAccess
- the time when the internal value was accessed- Returns:
- the internal value
-
getInternalValue
Access internal value without updating access expiry. Added this method for accessing value to construct a CacheEntryEvent. This access should not be considered for resetting expiry for an access. With StoreByReference configured to true, this access for CacheEntryEvent could end up modifying the LocalCachedValue in the LocalCache.- Returns:
- internal value
-
updateInternalValue
public LocalCacheValue updateInternalValue(Object internalValue, long ldtModification, javax.cache.expiry.ExpiryPolicy policy) Sets the internal value with the additional side-effect of updating the modification time to that which is specified and incrementing the modification count.- Parameters:
internalValue
- the new internal valueldtModification
- the time when the value was modifiedpolicy
- the expiry policy- Returns:
- this LocalCacheValue
-
accessInternalValue
public void accessInternalValue(long ldtAccess, javax.cache.expiry.ExpiryPolicy policy) Access value- Parameters:
ldtAccess
- the time when the value was accessedpolicy
- the expiry policy
-
createLoadedLocalCacheValue
public static LocalCacheValue createLoadedLocalCacheValue(Object internalValue, long ldtCreation, javax.cache.expiry.ExpiryPolicy policy) Create a LocalCacheValue marked with Synthetic marker that it was loaded. This distinction is necessary to ensure that a just read-through entry from an external resource is not immediately written back to external resource via write-through.- Parameters:
internalValue
- internal format of value of a LocalCache entryldtCreation
- creation timepolicy
- expiry policy to use- Returns:
- a
LocalCacheValue
marked as loaded via read-through
-
createLocalCacheValue
public static LocalCacheValue createLocalCacheValue(Object internalValue, long ldtCreation, javax.cache.expiry.ExpiryPolicy policy) Create a LocalCacheValue for an LocalCache entry.- Parameters:
internalValue
- internal format of valueldtCreation
- entry creation timepolicy
- expiry policy to use to generate expiry for the new LocalCache entry.- Returns:
LocalCache
with appropriate JCache MetaInfo.
-
isSyntheticUpdate
public boolean isSyntheticUpdate()determine if last update was considered synthetic- Returns:
- synthetic update state
-
isLoaded
public boolean isLoaded()Determine if last update to this LocalValue was a load from an external resource.- Returns:
- true iff this value has not been updated since it was last loaded.
-