cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

custom ehcache is not getting created

bsandeep544
Explorer
0 Likes
687

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

Hi ,

It's good to create a new spring xml file in your extension, and mention the spring xml in global context property in your extension as follows

xxx . global−context=xxx−cache−spring . xml

Thanks,

Venki