Interface InternalEntryFactory

All Known Implementing Classes:
InternalEntryFactoryImpl

public interface InternalEntryFactory
A factory for InternalCacheEntry and InternalCacheValue instances.
Since:
5.1
Author:
Manik Surtani
  • Method Details

    • create

      <K, V> InternalCacheEntry<K,V> create(CacheEntry<K,V> cacheEntry)
      Creates a new InternalCacheEntry instance based on the key, value, version and timestamp/lifespan information reflected in the CacheEntry instance passed in.
      Type Parameters:
      K - The key type for the entry
      V - The value type for the entry
      Parameters:
      cacheEntry - cache entry to copy
      Returns:
      a new InternalCacheEntry
    • create

      <K, V> InternalCacheEntry<K,V> create(K key, V value, InternalCacheEntry<?,?> cacheEntry)
      Creates a new InternalCacheEntry instance based on the version and timestamp/lifespan information reflected in the CacheEntry instance passed in. Key and value are both passed in explicitly.
      Type Parameters:
      K - The key type for the entry
      V - The value type for the entry
      Parameters:
      key - key to use
      value - value to use
      cacheEntry - cache entry to retrieve version and timestamp/lifespan information from
      Returns:
      a new InternalCacheEntry
    • create

      <K, V> InternalCacheEntry<K,V> create(K key, V value, Metadata metadata)
      Creates a new InternalCacheEntry instance
      Type Parameters:
      K - The key type for the entry
      V - The value type for the entry
      Parameters:
      key - key to use
      value - value to use
      metadata - 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 new InternalCacheEntry instance
      Type Parameters:
      K - The key type for the entry
      V - The value type for the entry
      Parameters:
      key - key to use
      value - value to use
      metadata - metadata for entry
      lifespan - lifespan to use
      maxIdle - 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 new InternalCacheEntry instance
      Type Parameters:
      K - The key type for the entry
      V - The value type for the entry
      Parameters:
      key - key to use
      value - value to use
      metadata - metadata for entry
      created - creation timestamp to use
      lifespan - lifespan to use
      lastUsed - lastUsed timestamp to use
      maxIdle - 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 new InternalCacheEntry instance
      Type Parameters:
      K - The key type for the entry
      V - The value type for the entry
      Parameters:
      key - key to use
      value - value to use
      version - version to use
      created - creation timestamp to use
      lifespan - lifespan to use
      lastUsed - lastUsed timestamp to use
      maxIdle - maxIdle to use
      Returns:
      a new InternalCacheEntry
    • update

      <K, V> InternalCacheEntry<K,V> update(InternalCacheEntry<K,V> cacheEntry, Metadata metadata)
      TODO: Adjust javadoc Updates an existing InternalCacheEntry with new metadata. This may result in a new InternalCacheEntry instance being created, as a different InternalCacheEntry implementation may be more appropriate to suit the new metadata values. As such, one should consider the InternalCacheEntry passed in as a parameter as passed by value and not by reference.
      Type Parameters:
      K - The key type for the entry
      V - The value type for the entry
      Parameters:
      cacheEntry - original internal cache entry
      metadata - new metadata
      Returns:
      a new InternalCacheEntry instance
    • update

      <K, V> InternalCacheEntry<K,V> update(InternalCacheEntry<K,V> cacheEntry, V value, Metadata metadata)
      Similar to update(org.infinispan.container.entries.InternalCacheEntry, org.infinispan.metadata.Metadata) but it also updates the InternalCacheEntry 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 entry
      V - The value type for the entry
      Parameters:
      cacheEntry - original internal cache entry
      value - new value
      metadata - new metadata
      Returns:
      a new InternalCacheEntry instance or the existing original
    • createValue

      <V> InternalCacheValue<V> createValue(CacheEntry<?,V> cacheEntry)
      Creates an InternalCacheValue based on the InternalCacheEntry passed in.
      Type Parameters:
      V - The value type
      Parameters:
      cacheEntry - to use to generate a InternalCacheValue
      Returns:
      an InternalCacheValue
    • copy

      <K, V> CacheEntry<K,V> copy(CacheEntry<K,V> cacheEntry)
      Creates a copy of this cache entry and synchronizes serializes the copy process with the 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.
      Type Parameters:
      K - The key type for the entry
      V - The value type for the entry
    • createL1

      <K, V> InternalCacheEntry<K,V> createL1(K key, V value, Metadata metadata)
      Creates a L1 entry.
      Type Parameters:
      K - The key type for the entry
      V - The value type for the entry
      Parameters:
      key -
      value -
      Returns:
      a new InternalCacheEntry
    • getValueFromCtx

      <K, V> InternalCacheValue<V> getValueFromCtx(K key, InvocationContext ctx)
      Retrieve an InternalCacheValue from the provided InvocationContext if an InternalCacheEntry exists, otherwise create InternalCacheEntry from the context's CacheEntry 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 entry
      V - The value type for the entry
      Parameters:
      key - the key of the entry to be retrieved
      ctx - the invocation context from which the value should be retrieved
      Returns:
      an InternalCacheValue