Interface FlexibleCache<K,V>

All Superinterfaces:
EvictableCache<K,V>, Map<K,V>, MemoizeCache<K,V>
All Known Implementing Classes:
CommonCache, ConcurrentCommonCache, ConcurrentSoftCache, StampedCommonCache

public interface FlexibleCache<K,V> extends EvictableCache<K,V>
An EvictableCache supporting a getAndPut variant with additional control over caching.
Since:
5.0.0
  • Method Details

    • getAndPut

      V getAndPut(K key, MemoizeCache.ValueProvider<? super K,? extends V> valueProvider, boolean shouldCache)
      Returns the value associated with key, creating it with the supplied provider when necessary and optionally caching the result.
      Parameters:
      key - the key to look up
      valueProvider - supplies a value when the key is not cached
      shouldCache - whether a newly created value should be stored
      Returns:
      the cached or newly created value