Package io.jmix.core
Class CacheOperations
java.lang.Object
io.jmix.core.CacheOperations
Used for additional cache operation like iterations over cache entries.
 Spring cache API doesn't support some operations over cache (e.g. iterations),
 so the 
CacheOperations facade uses specific API of cache implementations.- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescription<K,V> void forEach(org.springframework.cache.Cache cache, BiConsumer<K, V> consumer) <K,V> V Used as safe alternative forCache.get(java.lang.Object, java.util.concurrent.Callable)<K> Set<K>getKeys(org.springframework.cache.Cache cache) <V> Collection<V>getValues(org.springframework.cache.Cache cache) booleanisIterableCache(org.springframework.cache.Cache cache) Iterations over cache entries are supported for JCache and defaultConcurrentMapCache.
- 
Constructor Details- 
CacheOperationspublic CacheOperations()
 
- 
- 
Method Details- 
isIterableCachepublic boolean isIterableCache(org.springframework.cache.Cache cache) Iterations over cache entries are supported for JCache and defaultConcurrentMapCache.- Parameters:
- cache-
- Returns:
- true if supported
 
- 
forEach
- 
getKeys- Parameters:
- cache- - cache
- Returns:
- a set view of the keys contained in this cache
 
- 
getValues- Parameters:
- cache- - cache
- Returns:
- a collection of the values contained in this cache
 
- 
get@Nullable public <K,V> V get(org.springframework.cache.Cache cache, K key, Callable<V> valueLoader) Used as safe alternative forCache.get(java.lang.Object, java.util.concurrent.Callable)
 WARNING: do not use Cache#get(java.lang.Object, java.util.concurrent.Callable) with Hazelcast. It causes NotSerializableException becauseorg.springframework.cache.jcache.JCacheCache#ValueLoaderEntryProcessoris not serializable.- Type Parameters:
- K- key type
- V- value type
- Parameters:
- cache- to get value from
- key- to get value by
- valueLoader- to load value in case of absence in cache
- Returns:
- cached value
 
 
-