Package org.infinispan.container.impl
Interface InternalEntryFactory
- All Known Implementing Classes:
InternalEntryFactoryImpl
public interface InternalEntryFactory
A factory for
InternalCacheEntry
and InternalCacheValue
instances.- Since:
- 5.1
- Author:
- Manik Surtani
-
Method Summary
Modifier and TypeMethodDescription<K,
V> CacheEntry <K, V> copy
(CacheEntry<K, V> cacheEntry) Creates a copy of this cache entry and synchronizes serializes the copy process with theupdate(org.infinispan.container.entries.InternalCacheEntry, org.infinispan.metadata.Metadata)
.<K,
V> InternalCacheEntry <K, V> create
(K key, V value, InternalCacheEntry<?, ?> cacheEntry) Creates a newInternalCacheEntry
instance based on the version and timestamp/lifespan information reflected in theCacheEntry
instance passed in.<K,
V> InternalCacheEntry <K, V> create
(K key, V value, EntryVersion version, long created, long lifespan, long lastUsed, long maxIdle) Creates a newInternalCacheEntry
instance<K,
V> InternalCacheEntry <K, V> Creates a newInternalCacheEntry
instance<K,
V> InternalCacheEntry <K, V> Creates a newInternalCacheEntry
instance<K,
V> InternalCacheEntry <K, V> Creates a newInternalCacheEntry
instance<K,
V> InternalCacheEntry <K, V> create
(CacheEntry<K, V> cacheEntry) Creates a newInternalCacheEntry
instance based on the key, value, version and timestamp/lifespan information reflected in theCacheEntry
instance passed in.<K,
V> InternalCacheEntry <K, V> Creates a L1 entry.<V> InternalCacheValue
<V> createValue
(CacheEntry<?, V> cacheEntry) Creates anInternalCacheValue
based on theInternalCacheEntry
passed in.<K,
V> InternalCacheValue <V> getValueFromCtx
(K key, InvocationContext ctx) Retrieve anInternalCacheValue
from the providedInvocationContext
if anInternalCacheEntry
exists, otherwise createInternalCacheEntry
from the context'sCacheEntry
and return its value.<K,
V> InternalCacheEntry <K, V> update
(InternalCacheEntry<K, V> cacheEntry, Metadata metadata) TODO: Adjust javadoc Updates an existingInternalCacheEntry
with new metadata.<K,
V> InternalCacheEntry <K, V> update
(InternalCacheEntry<K, V> cacheEntry, V value, Metadata metadata) Similar toupdate(org.infinispan.container.entries.InternalCacheEntry, org.infinispan.metadata.Metadata)
but it also updates theInternalCacheEntry
value.
-
Method Details
-
create
Creates a newInternalCacheEntry
instance based on the key, value, version and timestamp/lifespan information reflected in theCacheEntry
instance passed in.- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
cacheEntry
- cache entry to copy- Returns:
- a new InternalCacheEntry
-
create
Creates a newInternalCacheEntry
instance based on the version and timestamp/lifespan information reflected in theCacheEntry
instance passed in. Key and value are both passed in explicitly.- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
key
- key to usevalue
- value to usecacheEntry
- cache entry to retrieve version and timestamp/lifespan information from- Returns:
- a new InternalCacheEntry
-
create
Creates a newInternalCacheEntry
instance- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
key
- key to usevalue
- value to usemetadata
- metadata for entry- Returns:
- a new InternalCacheEntry
-
create
<K,V> InternalCacheEntry<K,V> create(K key, V value, Metadata metadata, long lifespan, long maxIdle) Creates a newInternalCacheEntry
instance- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
key
- key to usevalue
- value to usemetadata
- metadata for entrylifespan
- lifespan to usemaxIdle
- maxIdle to use- Returns:
- a new InternalCacheEntry
-
create
<K,V> InternalCacheEntry<K,V> create(K key, V value, Metadata metadata, long created, long lifespan, long lastUsed, long maxIdle) Creates a newInternalCacheEntry
instance- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
key
- key to usevalue
- value to usemetadata
- metadata for entrycreated
- creation timestamp to uselifespan
- lifespan to uselastUsed
- lastUsed timestamp to usemaxIdle
- maxIdle to use- Returns:
- a new InternalCacheEntry
-
create
<K,V> InternalCacheEntry<K,V> create(K key, V value, EntryVersion version, long created, long lifespan, long lastUsed, long maxIdle) Creates a newInternalCacheEntry
instance- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
key
- key to usevalue
- value to useversion
- version to usecreated
- creation timestamp to uselifespan
- lifespan to uselastUsed
- lastUsed timestamp to usemaxIdle
- maxIdle to use- Returns:
- a new InternalCacheEntry
-
update
TODO: Adjust javadoc Updates an existingInternalCacheEntry
with new metadata. This may result in a newInternalCacheEntry
instance being created, as a differentInternalCacheEntry
implementation may be more appropriate to suit the new metadata values. As such, one should consider theInternalCacheEntry
passed in as a parameter as passed by value and not by reference.- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
cacheEntry
- original internal cache entrymetadata
- new metadata- Returns:
- a new InternalCacheEntry instance
-
update
<K,V> InternalCacheEntry<K,V> update(InternalCacheEntry<K, V> cacheEntry, V value, Metadata metadata) Similar toupdate(org.infinispan.container.entries.InternalCacheEntry, org.infinispan.metadata.Metadata)
but it also updates theInternalCacheEntry
value. If the same internal cache entry is returned and if it is a mortal cache entry, the returned instance needs to be reincarnated.- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
cacheEntry
- original internal cache entryvalue
- new valuemetadata
- new metadata- Returns:
- a new InternalCacheEntry instance or the existing original
-
createValue
Creates anInternalCacheValue
based on theInternalCacheEntry
passed in.- Type Parameters:
V
- The value type- Parameters:
cacheEntry
- to use to generate aInternalCacheValue
- Returns:
- an
InternalCacheValue
-
copy
Creates a copy of this cache entry and synchronizes serializes the copy process with theupdate(org.infinispan.container.entries.InternalCacheEntry, org.infinispan.metadata.Metadata)
. This is requires so that readers of the entry will get an consistent snapshot of the value red.- Type Parameters:
K
- The key type for the entryV
- The value type for the entry
-
createL1
Creates a L1 entry.- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
key
-value
- @return a newInternalCacheEntry
-
getValueFromCtx
Retrieve anInternalCacheValue
from the providedInvocationContext
if anInternalCacheEntry
exists, otherwise createInternalCacheEntry
from the context'sCacheEntry
and return its value.If the entry is not in the context a null value is returned
- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
key
- the key of the entry to be retrievedctx
- the invocation context from which the value should be retrieved- Returns:
- an
InternalCacheValue
-