Class ClarityClientCacheConfiguration

java.lang.Object
org.cruk.clarity.api.cache.spring.ClarityClientCacheConfiguration

@Configuration @EnableAspectJAutoProxy(proxyTargetClass=false) @ComponentScan(basePackages="org.cruk.clarity.api.cache", excludeFilters=) public class ClarityClientCacheConfiguration extends Object
Spring configuration class for the Clarity API cache. Configures the EhCache cache manager with specific cache configurations for different entity types. Each cache is configured with appropriate heap size limits and time-to-idle expiry policies based on the expected usage patterns of different entity types.
Since:
2.31
  • Field Details

    • smallMedium

      protected CacheConfiguration<String,org.cruk.clarity.api.cache.internal.CacheElementWrapper> smallMedium
      Cache configuration for small heap (100 entries) with medium expiry (10 minutes).
    • smallLong

      protected CacheConfiguration<String,org.cruk.clarity.api.cache.internal.CacheElementWrapper> smallLong
      Cache configuration for small heap (100 entries) with long expiry (30 minutes).
    • mediumShort

      protected CacheConfiguration<String,org.cruk.clarity.api.cache.internal.CacheElementWrapper> mediumShort
      Cache configuration for medium heap (250 entries) with short expiry (5 minutes).
    • mediumMedium

      protected CacheConfiguration<String,org.cruk.clarity.api.cache.internal.CacheElementWrapper> mediumMedium
      Cache configuration for medium heap (250 entries) with medium expiry (10 minutes).
    • largeShort

      protected CacheConfiguration<String,org.cruk.clarity.api.cache.internal.CacheElementWrapper> largeShort
      Cache configuration for large heap (1800 entries) with short expiry (5 minutes).
  • Constructor Details

    • ClarityClientCacheConfiguration

      public ClarityClientCacheConfiguration()
      Constructor. Initializes the pre-configured cache configurations with different combinations of heap size and expiry times.
  • Method Details

    • cacheConfig

      protected CacheConfiguration<String,org.cruk.clarity.api.cache.internal.CacheElementWrapper> cacheConfig(int number, int expiry)
      Creates a cache configuration with the specified heap size and time-to-idle expiry.
      Parameters:
      number - The maximum number of entries in the cache heap.
      expiry - The time-to-idle expiry time in minutes.
      Returns:
      A configured cache configuration for String keys and CacheElementWrapper values.
    • clarityCacheManager

      @Bean public CacheManager clarityCacheManager()
      Creates and configures the EhCache cache manager for Clarity API entities. Registers separate caches for each entity type with appropriate size and expiry configurations based on usage patterns. The cache manager is automatically closed when the Spring context is destroyed.
      Returns:
      The configured cache manager, initialized and ready for use.