Class AssetEhcacheAutoConfiguration

java.lang.Object
com.broadleafcommerce.asset.autoconfigure.AssetEhcacheAutoConfiguration

@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({AssetCacheProperties.class,AssetCacheWeightProperties.class,AssetCacheSizeProperties.class}) public class AssetEhcacheAutoConfiguration extends Object
Configuration for engaging default Broadleaf support for Ehcache in the Asset service.

This configuration uses a weighted budgeting system to distribute a fixed memory footprint across all asset 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%)
Asset (by URL) 60% 2 KB ~1,382 2.7 MB
Storage Mapping 40% 1 KB ~1,843 1.8 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

    • AssetEhcacheAutoConfiguration

      public AssetEhcacheAutoConfiguration()
  • Method Details

    • assetEhcacheManagerCustomizer

      @Bean @ConditionalOnMissingBean(name="assetEhcacheManagerCustomizer") public org.springframework.boot.autoconfigure.cache.CacheManagerCustomizer<org.springframework.cache.jcache.JCacheCacheManager> assetEhcacheManagerCustomizer(com.broadleafcommerce.common.extension.cache.ehcache.EhcacheBudgetManager budgetManager, AssetCacheProperties props, AssetCacheWeightProperties weightProps, AssetCacheSizeProperties sizeProps)