Module spring.retry

Class AbstractMapRetryContextCache<V>

java.lang.Object
org.springframework.retry.policy.AbstractMapRetryContextCache<V>
All Implemented Interfaces:
RetryContextCache
Direct Known Subclasses:
MapRetryContextCache, SoftReferenceMapRetryContextCache

public abstract class AbstractMapRetryContextCache<V> extends Object implements RetryContextCache
Base RetryContextCache implementation that stores entries in memory, with a configurable maximum capacity and LRU eviction policy. For a cache used in a global state, any attempt to increase its capacity should result in an exception. However, a regular cache should not have permanent entries, and removing the eldest entries is sensible.
Since:
1.3.5
Author:
Stephane Nicoll
  • Field Details

    • DEFAULT_CAPACITY

      public static final int DEFAULT_CAPACITY
      Default value for maximum capacity of the cache. This is set to a reasonably low value (4096) to avoid users inadvertently filling the cache with item keys that are inconsistent.
      See Also:
  • Constructor Details

    • AbstractMapRetryContextCache

      protected AbstractMapRetryContextCache(int capacity, boolean removeEldestEntries)
      Create an instance with the given capacity and the policy to apply when the cache is full.
      Parameters:
      capacity - the size of the cache
      removeEldestEntries - whether to remove the eldest entries when the cache is full
  • Method Details