Package org.infinispan.container.entries
Interface InternalCacheValue<V>
- All Known Implementing Classes:
ImmortalCacheValue
,MetadataImmortalCacheValue
,MetadataMortalCacheValue
,MetadataTransientCacheValue
,MetadataTransientMortalCacheValue
,MortalCacheValue
,TransientCacheValue
,TransientMortalCacheValue
public interface InternalCacheValue<V>
A representation of an InternalCacheEntry that does not have a reference to the key. This should be used if the key
is either not needed or available elsewhere as it is more efficient to marshall and unmarshall. Probably most useful
in cache stores.
Note that this should not be used to optimize memory overhead, since the saving of an additional reference to a key
(a single object reference) does not warrant the cost of constructing an InternalCacheValue, where an existing
InternalCacheEntry is already referenced.
Use of this interface only makes sense when marshalling is involved, since the cost of marshalling the key
again can be sidestepped using an InternalCacheValue if the key is already known/marshalled.
- Since:
- 4.0
- Author:
- Manik Surtani
-
Method Summary
Modifier and TypeMethodDescriptionboolean
long
long
long
long
long
getValue()
boolean
isExpired
(long now) default boolean
void
setInternalMetadata
(PrivateMetadata internalMetadata) <K> InternalCacheEntry
<K, V> toInternalCacheEntry
(K key)
-
Method Details
-
getValue
V getValue()- Returns:
- the value represented by this internal wrapper
-
toInternalCacheEntry
-
isExpired
boolean isExpired(long now) - Parameters:
now
- the current time as expressed bySystem.currentTimeMillis()
- Returns:
- true if the entry has expired; false otherwise
-
canExpire
boolean canExpire()- Returns:
- true if the entry can expire, false otherwise
-
isMaxIdleExpirable
default boolean isMaxIdleExpirable()- Returns:
- true if this entry can expire via max idle, false otherwise
-
getCreated
long getCreated()- Returns:
- timestamp when the entry was created
-
getLastUsed
long getLastUsed()- Returns:
- timestamp when the entry was last used
-
getLifespan
long getLifespan()- Returns:
- lifespan of the value
-
getMaxIdle
long getMaxIdle()- Returns:
- max idle time allowed
-
getExpiryTime
long getExpiryTime() -
getMetadata
Metadata getMetadata() -
getInternalMetadata
PrivateMetadata getInternalMetadata() -
setInternalMetadata
-