Class InvalidationCache<K,V>

java.lang.Object
org.infinispan.cache.impl.AbstractDelegatingCache<K,V>
org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
org.wildfly.clustering.cache.infinispan.embedded.AbstractAdvancedCache<K,V>
org.wildfly.clustering.cache.infinispan.embedded.InvalidationCache<K,V>
Type Parameters:
K - the cache key type
V - the cache value type
All Implemented Interfaces:
ConcurrentMap<K,V>, Map<K,V>, org.infinispan.AdvancedCache<K,V>, org.infinispan.Cache<K,V>, org.infinispan.cache.impl.InternalCache<K,V>, org.infinispan.commons.api.AsyncCache<K,V>, org.infinispan.commons.api.BasicCache<K,V>, org.infinispan.commons.api.BatchingCache, org.infinispan.commons.api.Lifecycle, org.infinispan.commons.api.TransactionalCache, org.infinispan.notifications.FilteringListenable<K,V>, org.infinispan.notifications.Listenable

public class InvalidationCache<K,V> extends AbstractAdvancedCache<K,V> implements org.infinispan.AdvancedCache<K,V>
Workaround for issues with invalidation caches. There are several types of cache write operations that require the current value: In order to perform these types of operations correctly, an invalidation cache must fetch the current value from the cache store if the entry is not already present in the data container. For whatever reason, Infinispan does not do this, which results in incorrect behavior.
Author:
Paul Ferraro
  • Nested Class Summary

    Nested classes/interfaces inherited from interface java.util.Map

    Map.Entry<K,V>
  • Field Summary

    Fields inherited from class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache

    cache
  • Constructor Summary

    Constructors
    Constructor
    Description
    InvalidationCache(org.infinispan.AdvancedCache<K,V> cache)
     
    InvalidationCache(org.infinispan.Cache<K,V> cache)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
     
    computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
     
    computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction, org.infinispan.metadata.Metadata metadata)
     
    computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction, org.infinispan.metadata.Metadata metadata)
     
    computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
     
    computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
     
    merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
     
    mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
     
    put(K key, V newValue, org.infinispan.metadata.Metadata metadata)
     
    putAsync(K key, V value, org.infinispan.metadata.Metadata metadata)
     
    putIfAbsent(K key, V newValue, org.infinispan.metadata.Metadata metadata)
     
    putIfAbsentAsync(K key, V newValue, org.infinispan.metadata.Metadata metadata)
     
     
     
    replace(K key, V newValue, org.infinispan.metadata.Metadata metadata)
     
    replaceAsync(K key, V newValue, org.infinispan.metadata.Metadata metadata)
     
    org.infinispan.AdvancedCache
    rewrap(org.infinispan.AdvancedCache cache)
     
    org.infinispan.AdvancedCache<K,V>
    withFlags(Collection<org.infinispan.context.Flag> flags)
     

    Methods inherited from class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache

    cacheEntrySet, cachePublisher, getAdvancedCache, getAll, getAllAsync, getAllCacheEntries, getAndPutAll, getAuthorizationManager, getAvailability, getBatchContainer, getCacheAvailability, getCacheEntry, getCacheEntryAsync, getClassLoader, getComponentRegistry, getDataContainer, getDistributionManager, getExpirationManager, getGroup, getKeyDataConversion, getLockManager, getRpcManager, getStats, getTransactionManager, getValueDataConversion, getXAResource, isRebalancingEnabled, lock, lock, lockAs, lockedStream, noFlags, putAll, putAllAsync, putAsyncEntry, putForExternalRead, putIfAbsentAsyncEntry, removeAsyncEntry, removeGroup, removeLifespanExpired, removeMaxIdleExpired, replace, replaceAsync, replaceAsyncEntry, setAvailability, setCacheAvailability, setRebalancingEnabled, touch, touch, transform, withEncoding, withEncoding, withKeyEncoding, withMediaType, withMediaType, withStorageMediaType, withSubject, withWrapping, withWrapping

    Methods inherited from class org.infinispan.cache.impl.AbstractDelegatingCache

    addFilteredListener, addFilteredListenerAsync, addListener, addListener, addListenerAsync, addListenerAsync, addStorageFormatFilteredListener, addStorageFormatFilteredListenerAsync, clear, clearAsync, containsKey, containsValue, continuousQuery, endBatch, entrySet, evict, forEach, get, getAsync, getCacheConfiguration, getCacheManager, getCacheName, getCacheStatus, getConfigurationAsProperties, getDelegate, getName, getOrDefault, getStatus, getVersion, isEmpty, keySet, query, remove, removeAsync, removeListener, removeListenerAsync, replace, replace, replace, replaceAll, replaceAsync, replaceAsync, replaceAsync, shutdown, size, sizeAsync, start, startBatch, stop, toString, unwrapCache, values

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.infinispan.AdvancedCache

    cacheEntrySet, cachePublisher, compute, computeAsync, computeIfAbsent, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, getAll, getAllCacheEntries, getAndPutAll, getAuthorizationManager, getAvailability, getBatchContainer, getCacheEntry, getCacheEntryAsync, getClassLoader, getDataContainer, getDistributionManager, getExpirationManager, getGroup, getKeyDataConversion, getLockManager, getRpcManager, getStats, getValueDataConversion, getXAResource, lock, lock, lockAs, lockedStream, merge, mergeAsync, noFlags, putAll, putAllAsync, putAsyncEntry, putForExternalRead, putIfAbsentAsyncEntry, removeAsyncEntry, removeGroup, removeLifespanExpired, removeMaxIdleExpired, replace, replaceAsync, replaceAsyncEntry, setAvailability, touch, touch, transform, withEncoding, withEncoding, withFlags, withFlags, withKeyEncoding, withMediaType, withMediaType, withStorageMediaType, withSubject, withWrapping, withWrapping

    Methods inherited from interface org.infinispan.commons.api.AsyncCache

    clearAsync, computeAsync, computeAsync, computeAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresentAsync, computeIfPresentAsync, computeIfPresentAsync, containsKeyAsync, getAllAsync, getAsync, mergeAsync, mergeAsync, mergeAsync, putAllAsync, putAllAsync, putAllAsync, putAsync, putAsync, putAsync, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, removeAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, sizeAsync

    Methods inherited from interface org.infinispan.commons.api.BasicCache

    compute, compute, computeIfAbsent, computeIfAbsent, computeIfPresent, computeIfPresent, continuousQuery, getName, getVersion, merge, merge, put, put, put, putAll, putAll, putIfAbsent, putIfAbsent, query, replace, replace, replace, replace

    Methods inherited from interface org.infinispan.commons.api.BatchingCache

    endBatch, startBatch

    Methods inherited from interface org.infinispan.Cache

    clear, compute, compute, compute, compute, computeAsync, computeAsync, computeAsync, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresent, computeIfPresent, computeIfPresentAsync, entrySet, evict, getAdvancedCache, getCacheConfiguration, getCacheManager, getStatus, keySet, merge, merge, merge, merge, mergeAsync, mergeAsync, mergeAsync, putForExternalRead, putForExternalRead, putForExternalRead, shutdown, size, stop, values

    Methods inherited from interface java.util.concurrent.ConcurrentMap

    forEach, getOrDefault, putIfAbsent, remove, replace, replace, replaceAll

    Methods inherited from interface org.infinispan.notifications.FilteringListenable

    addFilteredListener, addFilteredListenerAsync, addListener, addListenerAsync, addStorageFormatFilteredListener, addStorageFormatFilteredListenerAsync

    Methods inherited from interface org.infinispan.cache.impl.InternalCache

    bypassInvocationContextFactory

    Methods inherited from interface org.infinispan.commons.api.Lifecycle

    start

    Methods inherited from interface org.infinispan.notifications.Listenable

    addListener, addListenerAsync, removeListener, removeListenerAsync

    Methods inherited from interface java.util.Map

    containsKey, containsValue, equals, get, hashCode, isEmpty, putAll

    Methods inherited from interface org.infinispan.commons.api.TransactionalCache

    getTransactionManager
  • Constructor Details

    • InvalidationCache

      public InvalidationCache(org.infinispan.Cache<K,V> cache)
    • InvalidationCache

      public InvalidationCache(org.infinispan.AdvancedCache<K,V> cache)
  • Method Details

    • withFlags

      public org.infinispan.AdvancedCache<K,V> withFlags(Collection<org.infinispan.context.Flag> flags)
      Specified by:
      withFlags in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      withFlags in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • compute

      public V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
      Specified by:
      compute in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      compute in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • computeIfAbsent

      public V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction, org.infinispan.metadata.Metadata metadata)
      Specified by:
      computeIfAbsent in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      computeIfAbsent in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • computeIfPresent

      public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
      Specified by:
      computeIfPresent in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      computeIfPresent in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • merge

      public V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
      Specified by:
      merge in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      merge in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • put

      public V put(K key, V newValue, org.infinispan.metadata.Metadata metadata)
      Specified by:
      put in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      put in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • putIfAbsent

      public V putIfAbsent(K key, V newValue, org.infinispan.metadata.Metadata metadata)
      Specified by:
      putIfAbsent in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      putIfAbsent in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface org.infinispan.commons.api.BasicCache<K,V>
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class org.infinispan.cache.impl.AbstractDelegatingCache<K,V>
    • replace

      public V replace(K key, V newValue, org.infinispan.metadata.Metadata metadata)
      Specified by:
      replace in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      replace in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • computeAsync

      public CompletableFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
      Specified by:
      computeAsync in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      computeAsync in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • computeIfAbsentAsync

      public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction, org.infinispan.metadata.Metadata metadata)
      Specified by:
      computeIfAbsentAsync in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      computeIfAbsentAsync in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • computeIfPresentAsync

      public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
      Specified by:
      computeIfPresentAsync in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      computeIfPresentAsync in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • mergeAsync

      public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, org.infinispan.metadata.Metadata metadata)
      Specified by:
      mergeAsync in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      mergeAsync in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • putAsync

      public CompletableFuture<V> putAsync(K key, V value, org.infinispan.metadata.Metadata metadata)
      Specified by:
      putAsync in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      putAsync in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • putIfAbsentAsync

      public CompletableFuture<V> putIfAbsentAsync(K key, V newValue, org.infinispan.metadata.Metadata metadata)
      Specified by:
      putIfAbsentAsync in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      putIfAbsentAsync in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • removeAsync

      public CompletableFuture<V> removeAsync(Object key)
      Specified by:
      removeAsync in interface org.infinispan.commons.api.AsyncCache<K,V>
      Overrides:
      removeAsync in class org.infinispan.cache.impl.AbstractDelegatingCache<K,V>
    • replaceAsync

      public CompletableFuture<V> replaceAsync(K key, V newValue, org.infinispan.metadata.Metadata metadata)
      Specified by:
      replaceAsync in interface org.infinispan.AdvancedCache<K,V>
      Overrides:
      replaceAsync in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>
    • rewrap

      public org.infinispan.AdvancedCache rewrap(org.infinispan.AdvancedCache cache)
      Specified by:
      rewrap in class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache<K,V>