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 newInternalCacheEntryinstance based on the version and timestamp/lifespan information reflected in theCacheEntryinstance passed in.<K,V> InternalCacheEntry<K, V> create(K key, V value, EntryVersion version, long created, long lifespan, long lastUsed, long maxIdle) Creates a newInternalCacheEntryinstance<K,V> InternalCacheEntry<K, V> Creates a newInternalCacheEntryinstance<K,V> InternalCacheEntry<K, V> Creates a newInternalCacheEntryinstance<K,V> InternalCacheEntry<K, V> Creates a newInternalCacheEntryinstance<K,V> InternalCacheEntry<K, V> create(CacheEntry<K, V> cacheEntry) Creates a newInternalCacheEntryinstance based on the key, value, version and timestamp/lifespan information reflected in theCacheEntryinstance passed in.<K,V> InternalCacheEntry<K, V> Creates a L1 entry.<V> InternalCacheValue<V>createValue(CacheEntry<?, V> cacheEntry) Creates anInternalCacheValuebased on theInternalCacheEntrypassed in.<K,V> InternalCacheValue<V> getValueFromCtx(K key, InvocationContext ctx) Retrieve anInternalCacheValuefrom the providedInvocationContextif anInternalCacheEntryexists, otherwise createInternalCacheEntryfrom the context'sCacheEntryand return its value.<K,V> InternalCacheEntry<K, V> update(InternalCacheEntry<K, V> cacheEntry, Metadata metadata) TODO: Adjust javadoc Updates an existingInternalCacheEntrywith 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 theInternalCacheEntryvalue.
-
Method Details
-
create
Creates a newInternalCacheEntryinstance based on the key, value, version and timestamp/lifespan information reflected in theCacheEntryinstance 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 newInternalCacheEntryinstance based on the version and timestamp/lifespan information reflected in theCacheEntryinstance 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 newInternalCacheEntryinstance- 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 newInternalCacheEntryinstance- 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 newInternalCacheEntryinstance- 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 newInternalCacheEntryinstance- 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 existingInternalCacheEntrywith new metadata. This may result in a newInternalCacheEntryinstance being created, as a differentInternalCacheEntryimplementation may be more appropriate to suit the new metadata values. As such, one should consider theInternalCacheEntrypassed 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 theInternalCacheEntryvalue. 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 anInternalCacheValuebased on theInternalCacheEntrypassed 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-- Returns:
- a new
InternalCacheEntry
-
getValueFromCtx
Retrieve anInternalCacheValuefrom the providedInvocationContextif anInternalCacheEntryexists, otherwise createInternalCacheEntryfrom the context'sCacheEntryand 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
-