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

Server side caching with ehcache

Former Member
0 Kudos
880

Hi everybody,

I want to use Server side caching with an ehcache to cache some Controller methods. I've already created a new ehcache.xml file and edited the cache-config-spring.xml No I annotate the controller method with @Cachable but it seems that it doesnt work.

Do you have some experience with server caching? Where can I find all created caches from the ehcache.xml files?

cache-config-spring.xml

 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:cache="http://www.springframework.org/schema/cache"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:utils="http://www.springframework.org/schema/util"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/cache
          http://www.springframework.org/schema/cache/spring-cache.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">;
 
     <cache:annotation-driven cache-manager="compositeWsCacheManager" key-generator="wsCacheKeyGenerator"/>
 
     <alias name="defaultWsCacheManagerList" alias="wsCacheManagerList"/>
     <utils:list id="defaultWsCacheManagerList">
         <ref bean="wsCacheManager"/>
     </utils:list>
 
 
     <alias name="defaultCompositeWSCacheManager" alias="compositeWsCacheManager"/>
     <bean id="defaultCompositeWSCacheManager" class="org.springframework.cache.support.CompositeCacheManager">
         <property name="cacheManagers">
             <ref bean="wsCacheManagerList"/>
         </property>
     </bean>
 
     <alias name="defaultWSCacheManager" alias="wsCacheManager"/>
     <bean id="defaultWSCacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
         <property name="cacheManager" ref="wsEhcache"/>
     </bean>
 
     <alias name="defaultWSEhcache" alias="wsEhcache"/>
     <bean id="defaultWSEhcache" class="de.hybris.platform.webservicescommons.cache.TenantAwareEhCacheManagerFactoryBean">
         <property name="cacheNamePrefix" value="productFinder"/>
         <property name="configLocation" value="${customextension.ehcache.location:/WEB-INF/cache/ehcache.xml}"/>
         <property name="acceptExisting" value="true" />
     </bean>
 
 </beans>
 

Thanks to all!

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member1320010
Participant
0 Kudos

in this post (https://answers.sap.com/questions/12770300/does.html?childToView=12803784#answer-12803784) i tried to explain how i was able to use the ehcache for one of my services extension... as mentioned above by Markus not sure if you use ycommercewebservices

Former Member
0 Kudos

I can debug into my cache but can not see anything in the hac

mpern
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can find all(?) caches in the administration console (Monitoring -> Cache)

and unfortunately, the @Cachable annotation only works in ycommercewebservices, so I would steal the setup from there ( ycommercewebservices/web/webroot/WEB-INF/config/common/cache-config-spring.xml)