Package org.infinispan.container.impl
Class InternalEntryFactoryImpl
java.lang.Object
org.infinispan.container.impl.InternalEntryFactoryImpl
- All Implemented Interfaces:
InternalEntryFactory
An implementation that generates non-versioned entries
- Since:
- 5.1
- Author:
- Manik Surtani
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy
(CacheEntry cacheEntry) Creates a copy of this cache entry and synchronizes serializes the copy process with theInternalEntryFactory.update(org.infinispan.container.entries.InternalCacheEntry, org.infinispan.metadata.Metadata)
.create
(Object key, Object value, InternalCacheEntry cacheEntry) Creates a newInternalCacheEntry
instance based on the version and timestamp/lifespan information reflected in theCacheEntry
instance passed in.create
(Object key, Object value, EntryVersion version, long created, long lifespan, long lastUsed, long maxIdle) Creates a newInternalCacheEntry
instanceCreates a newInternalCacheEntry
instanceCreates a newInternalCacheEntry
instancecreate
(Object key, Object value, Metadata metadata, long created, long lifespan, long lastUsed, long maxIdle) Creates a newInternalCacheEntry
instancecreate
(CacheEntry cacheEntry) Creates a newInternalCacheEntry
instance based on the key, value, version and timestamp/lifespan information reflected in theCacheEntry
instance passed in.<K,
V> InternalCacheEntry Creates a L1 entry.createValue
(CacheEntry 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.static boolean
isStoreMetadata
(Metadata metadata, InternalCacheEntry ice) Indicates whether the entire metadata object needs to be stored or not.update
(InternalCacheEntry cacheEntry, Object value, Metadata metadata) Similar toInternalEntryFactory.update(org.infinispan.container.entries.InternalCacheEntry, org.infinispan.metadata.Metadata)
but it also updates theInternalCacheEntry
value.update
(InternalCacheEntry ice, Metadata metadata) TODO: Adjust javadoc Updates an existingInternalCacheEntry
with new metadata.
-
Constructor Details
-
InternalEntryFactoryImpl
public InternalEntryFactoryImpl()
-
-
Method Details
-
create
Description copied from interface:InternalEntryFactory
Creates a newInternalCacheEntry
instance- Specified by:
create
in interfaceInternalEntryFactory
- Parameters:
key
- key to usevalue
- value to usemetadata
- metadata for entry- Returns:
- a new InternalCacheEntry
-
create
Description copied from interface:InternalEntryFactory
Creates a newInternalCacheEntry
instance based on the key, value, version and timestamp/lifespan information reflected in theCacheEntry
instance passed in.- Specified by:
create
in interfaceInternalEntryFactory
- Parameters:
cacheEntry
- cache entry to copy- Returns:
- a new InternalCacheEntry
-
create
Description copied from interface:InternalEntryFactory
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.- Specified by:
create
in interfaceInternalEntryFactory
- Parameters:
key
- key to usevalue
- value to usecacheEntry
- cache entry to retrieve version and timestamp/lifespan information from- Returns:
- a new InternalCacheEntry
-
create
public InternalCacheEntry create(Object key, Object value, EntryVersion version, long created, long lifespan, long lastUsed, long maxIdle) Description copied from interface:InternalEntryFactory
Creates a newInternalCacheEntry
instance- Specified by:
create
in interfaceInternalEntryFactory
- 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
-
create
public InternalCacheEntry create(Object key, Object value, Metadata metadata, long created, long lifespan, long lastUsed, long maxIdle) Description copied from interface:InternalEntryFactory
Creates a newInternalCacheEntry
instance- Specified by:
create
in interfaceInternalEntryFactory
- 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
-
createValue
Description copied from interface:InternalEntryFactory
Creates anInternalCacheValue
based on theInternalCacheEntry
passed in.- Specified by:
createValue
in interfaceInternalEntryFactory
- Parameters:
cacheEntry
- to use to generate aInternalCacheValue
- Returns:
- an
InternalCacheValue
-
create
public InternalCacheEntry create(Object key, Object value, Metadata metadata, long lifespan, long maxIdle) Description copied from interface:InternalEntryFactory
Creates a newInternalCacheEntry
instance- Specified by:
create
in interfaceInternalEntryFactory
- Parameters:
key
- key to usevalue
- value to usemetadata
- metadata for entrylifespan
- lifespan to usemaxIdle
- maxIdle to use- Returns:
- a new InternalCacheEntry
-
update
Description copied from interface:InternalEntryFactory
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.- Specified by:
update
in interfaceInternalEntryFactory
- Parameters:
ice
- original internal cache entrymetadata
- new metadata- Returns:
- a new InternalCacheEntry instance
-
update
Description copied from interface:InternalEntryFactory
Similar toInternalEntryFactory.update(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.- Specified by:
update
in interfaceInternalEntryFactory
- Parameters:
cacheEntry
- original internal cache entryvalue
- new valuemetadata
- new metadata- Returns:
- a new InternalCacheEntry instance or the existing original
-
copy
Description copied from interface:InternalEntryFactory
Creates a copy of this cache entry and synchronizes serializes the copy process with theInternalEntryFactory.update(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.- Specified by:
copy
in interfaceInternalEntryFactory
-
createL1
Description copied from interface:InternalEntryFactory
Creates a L1 entry.- Specified by:
createL1
in interfaceInternalEntryFactory
- Type Parameters:
K
- The key type for the entryV
- The value type for the entry- Parameters:
key
-value
- @return a newInternalCacheEntry
-
getValueFromCtx
Description copied from interface:InternalEntryFactory
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
- Specified by:
getValueFromCtx
in interfaceInternalEntryFactory
- 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
-
isStoreMetadata
Indicates whether the entire metadata object needs to be stored or not. This check is done to avoid keeping the entire metadata object around when only lifespan or maxIdle time is stored. If more information needs to be stored (i.e. version), or the metadata object is not the embedded one, keep the entire metadata object around.- Returns:
- true if the entire metadata object needs to be stored, otherwise simply store lifespan and/or maxIdle in existing cache entries
-