Class RedissonLoadingCache<K,V>

java.lang.Object
com.axelor.cache.redisson.AbstractRedissonCache<K,V,org.redisson.api.RMapCache<K,V>>
com.axelor.cache.redisson.RedissonCache<K,V>
com.axelor.cache.redisson.RedissonLoadingCache<K,V>
Type Parameters:
K - the type of keys maintained by this cache
V - the type of mapped values
All Implemented Interfaces:
AxelorCache<K,V>, Closeable, AutoCloseable, Iterable<Map.Entry<K,V>>

public class RedissonLoadingCache<K,V> extends RedissonCache<K,V>
Redisson loading cache with scripted eviction

This wraps a RMapCache and computes values using the CacheLoader on cache misses.

  • Constructor Details

    • RedissonLoadingCache

      public RedissonLoadingCache(org.redisson.api.RMapCache<K,V> cache, CacheLoader<K,V> loader)
  • Method Details

    • get

      public V get(K key)
      Description copied from interface: AxelorCache
      Returns the value associated with the key in this cache, obtaining that value from the CacheLoader if defined and if necessary, otherwise returns null if there is no cached value for the key.
      Specified by:
      get in interface AxelorCache<K,V>
      Overrides:
      get in class AbstractRedissonCache<K,V,org.redisson.api.RMapCache<K,V>>
      Parameters:
      key - the key whose associated value is to be returned
      Returns:
      the value to which the specified key is mapped, or null if this map contains no mapping for the key
    • getAll

      public Map<K,V> getAll(Set<K> keys)
      Description copied from interface: AxelorCache
      Returns a map of the values associated with the keys in this cache, using CacheLoader if defined and if necessary.
      Specified by:
      getAll in interface AxelorCache<K,V>
      Overrides:
      getAll in class AbstractRedissonCache<K,V,org.redisson.api.RMapCache<K,V>>
      Parameters:
      keys - the keys whose associated values are to be returned
      Returns:
      an unmodifiable mapping of keys to values for the specified keys in this cache