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
Constructors -
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 newInternalCacheEntryinstance based on the version and timestamp/lifespan information reflected in theCacheEntryinstance passed in.create(Object key, Object value, EntryVersion version, long created, long lifespan, long lastUsed, long maxIdle) Creates a newInternalCacheEntryinstanceCreates a newInternalCacheEntryinstanceCreates a newInternalCacheEntryinstancecreate(Object key, Object value, Metadata metadata, long created, long lifespan, long lastUsed, long maxIdle) Creates a newInternalCacheEntryinstancecreate(CacheEntry cacheEntry) Creates a newInternalCacheEntryinstance based on the key, value, version and timestamp/lifespan information reflected in theCacheEntryinstance passed in.<K,V> InternalCacheEntry Creates a L1 entry.createValue(CacheEntry 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.static booleanisStoreMetadata(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 theInternalCacheEntryvalue.update(InternalCacheEntry ice, Metadata metadata) TODO: Adjust javadoc Updates an existingInternalCacheEntrywith new metadata.
-
Constructor Details
-
InternalEntryFactoryImpl
public InternalEntryFactoryImpl()
-
-
Method Details
-
create
Description copied from interface:InternalEntryFactoryCreates a newInternalCacheEntryinstance- Specified by:
createin interfaceInternalEntryFactory- Parameters:
key- key to usevalue- value to usemetadata- metadata for entry- Returns:
- a new InternalCacheEntry
-
create
Description copied from interface:InternalEntryFactoryCreates a newInternalCacheEntryinstance based on the key, value, version and timestamp/lifespan information reflected in theCacheEntryinstance passed in.- Specified by:
createin interfaceInternalEntryFactory- Parameters:
cacheEntry- cache entry to copy- Returns:
- a new InternalCacheEntry
-
create
Description copied from interface:InternalEntryFactoryCreates a newInternalCacheEntryinstance based on the version and timestamp/lifespan information reflected in theCacheEntryinstance passed in. Key and value are both passed in explicitly.- Specified by:
createin 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:InternalEntryFactoryCreates a newInternalCacheEntryinstance- Specified by:
createin 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:InternalEntryFactoryCreates a newInternalCacheEntryinstance- Specified by:
createin 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:InternalEntryFactoryCreates anInternalCacheValuebased on theInternalCacheEntrypassed in.- Specified by:
createValuein 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:InternalEntryFactoryCreates a newInternalCacheEntryinstance- Specified by:
createin 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:InternalEntryFactoryTODO: 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.- Specified by:
updatein interfaceInternalEntryFactory- Parameters:
ice- original internal cache entrymetadata- new metadata- Returns:
- a new InternalCacheEntry instance
-
update
Description copied from interface:InternalEntryFactorySimilar toInternalEntryFactory.update(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.- Specified by:
updatein 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:InternalEntryFactoryCreates 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:
copyin interfaceInternalEntryFactory
-
createL1
Description copied from interface:InternalEntryFactoryCreates a L1 entry.- Specified by:
createL1in interfaceInternalEntryFactory- Type Parameters:
K- The key type for the entryV- The value type for the entry- Returns:
- a new
InternalCacheEntry
-
getValueFromCtx
Description copied from interface:InternalEntryFactoryRetrieve 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
- Specified by:
getValueFromCtxin 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
-