Class MetadataEhcacheAutoConfiguration

java.lang.Object
com.broadleafcommerce.metadata.autoconfigure.MetadataEhcacheAutoConfiguration

@Configuration @Conditional(com.broadleafcommerce.common.extension.cache.condition.OnEnabledCacheCondition.class) @ConditionalOnClass(org.springframework.cache.jcache.JCacheCacheManager.class) @ConditionalOnProperty(value="com.broadleafcommerce.cache.activeCacheManagerImplementation", havingValue="com.broadleafcommerce.common.extension.cache.ehcache.EhcacheAutoConfiguration") @EnableConfigurationProperties({MetadataCacheProperties.class,MetadataCacheWeightProperties.class,MetadataCacheSizeProperties.class}) public class MetadataEhcacheAutoConfiguration extends Object
Configuration for engaging default Broadleaf support for Ehcache in the Metadata service.

This configuration uses a weighted budgeting system to distribute a fixed memory footprint across all metadata cache regions. The following table illustrates the default distribution based on a 5MB Heap and 5MB Off-Heap budget:

Cache Name Weight Est. Size Heap Entries (90%) Off-Heap MB (90%)
Metadata Component 100% 20 KB ~230 4.5 MB

Note: The remaining 10% of each weighted budget is allocated to a companion "Keys" region used by the CacheStateManager for eviction tracking.

Author:
Jeff Fischer
  • Constructor Details

    • MetadataEhcacheAutoConfiguration

      public MetadataEhcacheAutoConfiguration()
  • Method Details

    • metadataEhcacheManagerCustomizer

      @Bean @ConditionalOnMissingBean(name="metadataEhcacheManagerCustomizer") public org.springframework.boot.autoconfigure.cache.CacheManagerCustomizer<org.springframework.cache.jcache.JCacheCacheManager> metadataEhcacheManagerCustomizer(com.broadleafcommerce.common.extension.cache.ehcache.EhcacheBudgetManager budgetManager, MetadataCacheProperties props, MetadataCacheWeightProperties weightProps, MetadataCacheSizeProperties sizeProps)