Skip to Content
0
Apr 26, 2018 at 02:28 PM

custom ehcache is not getting created

332 Views

Hi Team,

I followed several wiki links and trying to create a custom cache region. But i dont see that getting reflected in the below regions debug/ or in HAC, when i try to get all the regions available. Am i missing anything? and, how do we access / get to know if a key i have created is present in cache or not?

  1. any trial to create a new cache and add/ retrieve elements from it?

  2. How to access custom cache to look up for my key and retrieve value?

code:

Bean creation:

 <bean name="customCacheRegion" class="de.hybris.platform.regioncache.region.impl.EHCacheRegion">
     <constructor-arg name="name" value="customCacheRegion" />
     <constructor-arg name="maxEntries" value="${regioncache.contractPriceCache.size}" />
     <constructor-arg name="evictionPolicy" value="${regioncache.contractPriceCache.evictionpolicy}" />
     <constructor-arg name="statsEnabled" value="${regioncache.stats.enabled}" />
     <constructor-arg name="exclusiveComputation" value="${regioncache.exclusivecomputation}" />
     <constructor-arg name="ttlSeconds" value="${regioncache.contractPriceCache.ttl}" />
     <property name="handledTypes"><null/></property>
 </bean>

Registering bean :

 <bean id="customCacheRegion" class="de.hybris.platform.regioncache.region.CacheRegionRegistrar"
     c:region-ref="customCacheRegion" />

Trying to read from available regions:

@Autowired CacheController controller;

Collection regions = controller.getRegions(); for (CacheRegion region : regions) { CacheStatistics stats = region.getCacheRegionStatistics();

     }

Regards, Sandeep