Class StatsCollectingCache<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,,V> Map<K,,V> AdvancedCache<K,,V> Cache<K,,V> AsyncCache<K,,V> BasicCache<K,,V> BatchingCache,Lifecycle,TransactionalCache,FilteringListenable<K,,V> Listenable
AdvancedCache to collect statistics- Author:
- Radim Vansa <rvansa@redhat.com>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.infinispan.cache.impl.SimpleCacheImpl
SimpleCacheImpl.CacheEntryChange<K,V>, SimpleCacheImpl.CacheEntrySet, SimpleCacheImpl.EntrySet, SimpleCacheImpl.EntrySetBase<T extends Map.Entry<K, V>>, SimpleCacheImpl.KeySet, SimpleCacheImpl.ValueAndMetadata<V>, SimpleCacheImpl.Values -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected VcomputeIfAbsentInternal(K key, Function<? super K, ? extends V> mappingFunction, ByRef<V> newValueRef) protected VcomputeIfPresentInternal(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, SimpleCacheImpl.CacheEntryChange<K, V> ref) protected VcomputeInternal(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, SimpleCacheImpl.CacheEntryChange<K, V> ref) voidEvicts an entry from the memory of the cache.Gets a collection of entries, returning them asMapof the values associated with the set of keys requested.Map<K,CacheEntry<K, V>> getAllCacheEntries(Set<?> keys) Gets a collection of entries from theAdvancedCache, returning them asMapof the cache entries associated with the set of keys requested.getAndPutAll(Map<? extends K, ? extends V> entries) Executes an equivalent ofMap.putAll(Map), returning previous values of the modified entries.protected VgetAndPutInternal(K key, V value, Metadata metadata) protected VgetAndReplaceInternal(K key, V value, Metadata metadata) CacheEntry<K,V> Retrieves a CacheEntry corresponding to a specific key.getStats()Returns aStatsobject that allows several statistics associated with this cache at runtime.protected VmergeInternal(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, SimpleCacheImpl.CacheEntryChange<K, V> ref, Metadata metadata) protected voidputForExternalReadInternal(K key, V value, Metadata metadata, ByRef.Boolean isCreatedRef) protected VputIfAbsentInternal(K key, V value, Metadata metadata) If the return value of this operation will be ignored by the application, the user is strongly encouraged to use theFlag.IGNORE_RETURN_VALUESflag when invoking this method in order to make it behave as efficiently as possible (i.e.booleanprotected booleanreplaceInternal(K key, V oldValue, V value, Metadata metadata) toString()with(ClassLoader classLoader) A method that adds flags to any API call.Methods inherited from class org.infinispan.cache.impl.SimpleCacheImpl
addFilteredListenerAsync, addListenerAsync, addListenerAsync, addStorageFormatFilteredListenerAsync, cacheEntrySet, checkExpiration, clear, clearAsync, compute, compute, compute, compute, computeAsync, computeAsync, computeAsync, computeAsync, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresent, computeIfPresent, computeIfPresent, computeIfPresent, computeIfPresentAsync, computeIfPresentAsync, computeIfPresentAsync, computeIfPresentAsync, containsKey, containsValue, endBatch, entrySet, forEach, getAdvancedCache, getAllAsync, getAsync, getAsyncInterceptorChain, getAuthorizationManager, getAvailability, getBatchContainer, getCacheConfiguration, getCacheEntryAsync, getCacheManager, getCacheName, getCacheStatus, getClassLoader, getComponentRegistry, getConfigurationAsProperties, getDataContainer, getDistributionManager, getEvictionManager, getExpirationManager, getGroup, getKeyDataConversion, getListeners, getLockManager, getName, getRpcManager, getStatus, getStreamSupplier, getTransactionManager, getValueDataConversion, getVersion, getXAResource, isEmpty, keySet, lock, lock, lockAs, lockedStream, merge, merge, merge, merge, mergeAsync, mergeAsync, mergeAsync, mergeAsync, noFlags, put, put, put, put, putAll, putAll, putAll, putAll, putAllAsync, putAllAsync, putAllAsync, putAllAsync, putAllInternal, putAsync, putAsync, putAsync, putAsync, putAsyncEntry, putForExternalRead, putForExternalRead, putForExternalRead, putForExternalRead, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsyncEntry, removeAsync, removeAsync, removeAsyncEntry, removeGroup, removeLifespanExpired, removeListenerAsync, removeMaxIdleExpired, replace, replace, replace, replace, replace, replace, replace, replace, replaceAll, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsyncEntry, setAvailability, size, sizeAsync, start, startBatch, stop, touch, touch, transform, values, withEncoding, withEncoding, withFlags, withKeyEncoding, withMediaType, withMediaType, withStorageMediaType, withSubject, withWrapping, withWrappingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.AdvancedCache
compute, computeAsync, computeIfAbsent, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, merge, mergeAsync, putAsyncReturnEntry, putIfAbsentAsyncReturnEntry, removeAsyncReturnEntry, replaceAsyncReturnEntry, withFlagsMethods inherited from interface org.infinispan.commons.api.AsyncCache
containsKeyAsyncMethods inherited from interface org.infinispan.Cache
compute, compute, compute, computeAsync, computeAsync, computeAsync, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, merge, merge, merge, mergeAsync, mergeAsync, mergeAsync, shutdownMethods inherited from interface java.util.concurrent.ConcurrentMap
getOrDefaultMethods inherited from interface org.infinispan.notifications.FilteringListenable
addFilteredListener, addListener, addStorageFormatFilteredListenerMethods inherited from interface org.infinispan.notifications.Listenable
addListener, removeListener
-
Constructor Details
-
StatsCollectingCache
-
-
Method Details
-
withFlags
Description copied from interface:AdvancedCacheA method that adds flags to any API call. For example, consider the following code snippet:cache.withFlags(Flag.FORCE_WRITE_LOCK).get(key);
will invoke a cache.get() with a write lock forced. Note that for the flag to take effect, the cache operation must be invoked on the instance returned by this method. As an alternative to setting this on every invocation, users should also consider saving the decorated cache, as this allows for more readable code. E.g.:AdvancedCache<?, ?> forceWriteLockCache = cache.withFlags(Flag.FORCE_WRITE_LOCK); forceWriteLockCache.get(key1); forceWriteLockCache.get(key2); forceWriteLockCache.get(key3);- Specified by:
withFlagsin interfaceAdvancedCache<K,V> - Overrides:
withFlagsin classSimpleCacheImpl<K,V> - Parameters:
flags- a set of flags to apply. See theFlagdocumentation.- Returns:
- an
AdvancedCacheinstance on which a real operation is to be invoked, if the flags are to be applied.
-
with
- Specified by:
within interfaceAdvancedCache<K,V> - Overrides:
within classSimpleCacheImpl<K,V>
-
getStats
Description copied from interface:AdvancedCacheReturns aStatsobject that allows several statistics associated with this cache at runtime.- Specified by:
getStatsin interfaceAdvancedCache<K,V> - Overrides:
getStatsin classSimpleCacheImpl<K,V> - Returns:
- this cache's
Statsobject
-
get
-
getCacheEntry
Description copied from interface:AdvancedCacheRetrieves a CacheEntry corresponding to a specific key.- Specified by:
getCacheEntryin interfaceAdvancedCache<K,V> - Overrides:
getCacheEntryin classSimpleCacheImpl<K,V> - Parameters:
k- the key whose associated cache entry is to be returned- Returns:
- the cache entry to which the specified key is mapped, or
nullif this map contains no mapping for the key
-
getAll
Description copied from interface:AdvancedCacheGets a collection of entries, returning them asMapof the values associated with the set of keys requested.If the cache is configured read-through, and a get for a key would return null because an entry is missing from the cache, the Cache's
CacheLoaderis called in an attempt to load the entry. If an entry cannot be loaded for a given key, the returned Map will contain null for value of the key.Unlike other bulk methods if this invoked in an existing transaction all entries will be stored in the current transactional context
The returned
Mapwill be a copy and updates to the map will not be reflected in the Cache and vice versa. The keys and values themselves however may not be copies depending on if storeAsBinary is enabled and the value was retrieved from the local node.- Specified by:
getAllin interfaceAdvancedCache<K,V> - Overrides:
getAllin classSimpleCacheImpl<K,V> - Parameters:
keys- The keys whose associated values are to be returned.- Returns:
- A map of entries that were found for the given keys. If an entry is not found for a given key, it will not be in the returned map.
-
getAllCacheEntries
Description copied from interface:AdvancedCacheGets a collection of entries from theAdvancedCache, returning them asMapof the cache entries associated with the set of keys requested.If the cache is configured read-through, and a get for a key would return null because an entry is missing from the cache, the Cache's
CacheLoaderis called in an attempt to load the entry. If an entry cannot be loaded for a given key, the returned Map will contain null for value of the key.Unlike other bulk methods if this invoked in an existing transaction all entries will be stored in the current transactional context
The returned
Mapwill be a copy and updates to the map will not be reflected in the Cache and vice versa. The keys and values themselves however may not be copies depending on if storeAsBinary is enabled and the value was retrieved from the local node.- Specified by:
getAllCacheEntriesin interfaceAdvancedCache<K,V> - Overrides:
getAllCacheEntriesin classSimpleCacheImpl<K,V> - Parameters:
keys- The keys whose associated values are to be returned.- Returns:
- A map of entries that were found for the given keys. Keys not found in the cache are present in the map with null values.
-
getAndPutAll
Description copied from interface:AdvancedCacheExecutes an equivalent ofMap.putAll(Map), returning previous values of the modified entries.- Parameters:
entries- mappings to be stored in this map- Returns:
- A map of previous values for the given keys. If the previous mapping does not exist it will not be in the returned map.
-
evict
Description copied from interface:CacheEvicts an entry from the memory of the cache. Note that the entry is not removed from any configured cache stores or any other caches in the cluster (if used in a clustered mode). UseBasicCache.remove(Object)to remove an entry from the entire cache system. This method is designed to evict an entry from memory to free up memory used by the application. This method uses a 0 lock acquisition timeout so it does not block in attempting to acquire locks. It behaves as a no-op if the lock on the entry cannot be acquired immediately. Important: this method should not be called from within a transaction scope. -
getAndPutInternal
- Overrides:
getAndPutInternalin classSimpleCacheImpl<K,V>
-
getAndReplaceInternal
- Overrides:
getAndReplaceInternalin classSimpleCacheImpl<K,V>
-
putForExternalReadInternal
protected void putForExternalReadInternal(K key, V value, Metadata metadata, ByRef.Boolean isCreatedRef) - Overrides:
putForExternalReadInternalin classSimpleCacheImpl<K,V>
-
putIfAbsentInternal
- Overrides:
putIfAbsentInternalin classSimpleCacheImpl<K,V>
-
remove
Description copied from interface:BasicCacheIf the return value of this operation will be ignored by the application, the user is strongly encouraged to use theFlag.IGNORE_RETURN_VALUESflag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls). -
remove
-
replaceInternal
- Overrides:
replaceInternalin classSimpleCacheImpl<K,V>
-
computeIfAbsentInternal
protected V computeIfAbsentInternal(K key, Function<? super K, ? extends V> mappingFunction, ByRef<V> newValueRef) - Overrides:
computeIfAbsentInternalin classSimpleCacheImpl<K,V>
-
computeIfPresentInternal
protected V computeIfPresentInternal(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, SimpleCacheImpl.CacheEntryChange<K, V> ref) - Overrides:
computeIfPresentInternalin classSimpleCacheImpl<K,V>
-
computeInternal
protected V computeInternal(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, SimpleCacheImpl.CacheEntryChange<K, V> ref) - Overrides:
computeInternalin classSimpleCacheImpl<K,V>
-
mergeInternal
protected V mergeInternal(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, SimpleCacheImpl.CacheEntryChange<K, V> ref, Metadata metadata) - Overrides:
mergeInternalin classSimpleCacheImpl<K,V>
-
toString
- Overrides:
toStringin classSimpleCacheImpl<K,V>
-