Package org.infinispan.container.impl
Class InternalEntryFactoryImpl
- java.lang.Object
-
- org.infinispan.container.impl.InternalEntryFactoryImpl
-
- All Implemented Interfaces:
InternalEntryFactory
public class InternalEntryFactoryImpl extends Object implements InternalEntryFactory
An implementation that generates non-versioned entries- Since:
- 5.1
- Author:
- Manik Surtani
-
-
Constructor Summary
Constructors Constructor Description InternalEntryFactoryImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CacheEntry
copy(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)
.InternalCacheEntry
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.InternalCacheEntry
create(Object key, Object value, EntryVersion version, long created, long lifespan, long lastUsed, long maxIdle)
Creates a newInternalCacheEntry
instanceInternalCacheEntry
create(Object key, Object value, Metadata metadata)
Creates a newInternalCacheEntry
instanceInternalCacheEntry
create(Object key, Object value, Metadata metadata, long lifespan, long maxIdle)
Creates a newInternalCacheEntry
instanceInternalCacheEntry
create(Object key, Object value, Metadata metadata, long created, long lifespan, long lastUsed, long maxIdle)
Creates a newInternalCacheEntry
instanceInternalCacheEntry
create(CacheEntry cacheEntry)
Creates a newInternalCacheEntry
instance based on the key, value, version and timestamp/lifespan information reflected in theCacheEntry
instance passed in.<K,V>
InternalCacheEntrycreateL1(K key, V value, Metadata metadata)
Creates a L1 entry.InternalCacheValue
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.InternalCacheEntry
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.InternalCacheEntry
update(InternalCacheEntry ice, Metadata metadata)
TODO: Adjust javadoc Updates an existingInternalCacheEntry
with new metadata.
-
-
-
Method Detail
-
create
public InternalCacheEntry create(Object key, Object value, Metadata metadata)
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
public InternalCacheEntry create(CacheEntry cacheEntry)
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
public InternalCacheEntry create(Object key, Object value, InternalCacheEntry cacheEntry)
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
public InternalCacheValue createValue(CacheEntry cacheEntry)
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
public InternalCacheEntry update(InternalCacheEntry ice, Metadata metadata)
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
public InternalCacheEntry update(InternalCacheEntry cacheEntry, Object value, Metadata metadata)
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
public CacheEntry copy(CacheEntry cacheEntry)
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
public <K,V> InternalCacheEntry createL1(K key, V value, Metadata metadata)
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- Returns:
- a new
InternalCacheEntry
-
getValueFromCtx
public <K,V> InternalCacheValue<V> getValueFromCtx(K key, InvocationContext ctx)
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
public static boolean isStoreMetadata(Metadata metadata, InternalCacheEntry ice)
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
-
-