cancel
Showing results for 
Search instead for 
Did you mean: 

OCC extension and cache manager

Hello Experts,

At documentaion mentioned to use OCC extension as a preferable way to extend OCC.

https://help.sap.com/docs/SAP_COMMERCE/e5d7cec9064f453b84235dc582b886da/d46d19516961438f8939718e87ed...

I try it, but look like I can't find a way how to configure extra cache in this case. Here example how to do it for occaddon https://help.sap.com/docs/SAP_COMMERCE/9d346683b0084da2938be8a285c0c27a/00acb76c665940c498e49120eae7...

But looks like it's not possible to do with new architecture that SAP recomend to use, isn't it? Or do I miss something?

Best Regards,

Vitalii

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello,

Just saw some new comments arrived. Solution for me was quite simple, just define cache manager as normally did before. Next step was to add it to correct application context, so I did it in next way: project-prop.jpegproject-structure.jpeg

Normally everything works ok. By the way as 'cacheManager' already defined in commercewebservices and used, I just define 'customCacheManager'. So in web application context of commercewebservices will be two cache managers and in code need to be specified custom.

@Cacheable(value = "someCache", cacheManager = "customCacheManager")

 

Best Regards,

Vitalii

dominikbader
Explorer
0 Kudos
Thanks for your Feedback! Can you please also post the bean definition for "customCacheManager" with dependent beans.
0 Kudos
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd "> <alias name="defaultMyoccCacheManager" alias="customCacheManager"/> <bean id="defaultMyoccCacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"> <property name="cacheManager" ref="myoccEhcache"/> </bean> <alias name="defaultMyoccEhcache" alias="myoccEhcache"/> <bean id="defaultMyoccEhcache" class="de.hybris.platform.webservicescommons.cache.TenantAwareEhCacheManagerFactoryBean"> <property name="cacheNamePrefix" value="myoccCache_"/> <property name="configLocation" value="classpath:/myocc/cache/ehcache.xml"/> </bean> </beans>

Answers (3)

Answers (3)

ericyew94
Explorer

Hello Vitalii,

I might be answering this too late (but hopefully this would help someone else later on). I just found out about the 2211 version of the Extending Server-Side Caching documentation that works for my OCC extension. 

The cache manager definition of yours is very likely outdated for the OCC extension as I believe it was meant for the old addOn approach instead. The 2211 version of the guide is working for me. 

Eric

0 Kudos

Example of custom cache manager definition:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
">

    <alias name="defaultMyoccCacheManager" alias="customCacheManager"/>
    <bean id="defaultMyoccCacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
        <property name="cacheManager" ref="myoccEhcache"/>
    </bean>

    <alias name="defaultMyoccEhcache" alias="myoccEhcache"/>
    <bean id="defaultMyoccEhcache"
          class="de.hybris.platform.webservicescommons.cache.TenantAwareEhCacheManagerFactoryBean">
        <property name="cacheNamePrefix" value="myoccCache_"/>
        <property name="configLocation" value="classpath:/myocc/cache/ehcache.xml"/>
    </bean>

</beans>
dominikbader
Explorer
0 Kudos

We do have the same issue. Would be great to get a solution from SAP.

ericyew94
Explorer
0 Kudos
Hello Dominik,
ericyew94
Explorer
Hello Dominik, seems like SAP has provided the updated solution in the 2211 documentation. You can find the URL to the updated documentation in my answer to this question.