1

We want items to stay in DD4T cache eternally. Item needs to be evicted from DD4T cache only when its Published again or Un-Published, so no time bound restriction for the items. And its for both type of items

  1. Items that depend on other items.
  2. Items that don't depend on other items.

A. Is there any possible drawback/side-effect in this approach where items are evicted from cache only on Publish/UnPublish?

B. Below is the ehcache.xml for DD4T; what should be set in TTL and TTI parameters to achieve the goal ?

    <cache name="DD4T-Objects"
               eternal="false"
               maxEntriesLocalHeap="10000"
               timeToLiveSeconds="3600"
               timeToIdleSeconds="60"
               memoryStoreEvictionPolicy="LRU">
        </cache>
        <cache name="DD4T-Dependencies"
               maxEntriesLocalHeap="50000"
               memoryStoreEvictionPolicy="LRU">
        </cache>

I tried first to set a high integer value for TTL and TTI like 3600 = 1hour. Then I tried to set both TTL and TTI as zero (0) which ideally represent item never expired. But in both cases I am getting entries in logs which say item expired in DD4T cache, here same page is accessed multiple times after interval of two, three minutes. Logs pasted below.

2017-06-15 12:13:28,765 DEBUG DispatcherServlet - Last-Modified value for [/testapp/test_preheader_one_auth_ct/17064.dcp] is: -1
2017-06-15 12:13:28,766 DEBUG AbstractComponentPresentationController - >> GET component with viewPrefix: null, viewName: test_preheader_one_auth_ct and componentId: 17064
2017-06-15 12:13:28,766 DEBUG ComponentPresentationFactoryImpl - Enter getComponentPresentation with componentURI: tcm:301-17064-16 and templateURI: tcm:301-17071-32
2017-06-15 12:13:28,766 DEBUG CacheLogger - Element Component-301-17064-17071 expired in cache DD4T-Objects
2017-06-15 12:13:28,766 DEBUG CacheLogger - Element Component-301-17064-17071 inserted in cache DD4T-Objects
2017-06-15 12:13:28,766 DEBUG ComponentPresentationFactory - ComponentPresentationFactory.getComponentPresentation(int, int) found template metadata
2017-06-15 12:13:28,766 DEBUG ComponentPresentationFactory - ComponentPresentationFactory.getComponentPresentation(...) called with parameters (publicationId=301;componentId=17064;templateId=17071;type=HTML Fragment)
2017-06-15 12:13:28,766 DEBUG BaseBrokerProvider - Start decoding.
2017-06-15 12:13:28,766 DEBUG BaseBrokerProvider - End decoding and decompressing

Even if i set eternal="true" in ehcache.xml, still getting same result where items reported expired in logs.

After changing the version to 2.0.9 in pom.xml for all dd4t references still in the logs the same thing is happening. I am able to see lot of items marked expired. Is there a list of bugs/issues fixed on 2.0.9 somewhere ?

2017-06-20 10:26:23,920 DEBUG RenderUtils - Adding model with key: test_footer_ct and type com.sample.test.web.cms.model.Footer@10451f8f to the request stack
2017-06-20 10:26:23,921 DEBUG DispatcherServlet - DispatcherServlet with name 'dispatcher' processing GET request for [/testapp/test_footer_ct/7728.dcp]
2017-06-20 10:26:23,921 DEBUG RequestMappingHandlerMapping - Looking up handler method for path /test_footer_ct/7728.dcp
2017-06-20 10:26:23,930 DEBUG RequestMappingHandlerMapping - Returning handler method [public java.lang.String com.sample.test.web.controller.ComponentPresentationController.showComponentPresentation(java.lang.String,int,javax.servlet.http.HttpServletRequest)]
2017-06-20 10:26:23,930 DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'componentPresentationController'
2017-06-20 10:26:23,930 DEBUG DispatcherServlet - Last-Modified value for [/testapp/test_footer_ct/7728.dcp] is: -1
2017-06-20 10:26:23,930 DEBUG AbstractComponentPresentationController - >> GET component with viewPrefix: null, viewName: test_footer_ct and componentId: 7728
2017-06-20 10:26:23,930 DEBUG ComponentPresentationFactoryImpl - Enter getComponentPresentation with componentURI: tcm:301-7728-16 and templateURI: tcm:301-7759-32
2017-06-20 10:26:23,931 DEBUG CacheLogger - Element Component-301-7728-7759 expired in cache DD4T-Objects
2017-06-20 10:26:23,931 DEBUG CacheLogger - Element Component-301-7728-7759 inserted in cache DD4T-Objects
2017-06-20 10:26:23,931 DEBUG ComponentPresentationFactory - ComponentPresentationFactory.getComponentPresentation(int, int) found template metadata
2017-06-20 10:26:23,931 DEBUG ComponentPresentationFactory - ComponentPresentationFactory.getComponentPresentation(...) called with parameters (publicationId=301;componentId=7728;templateId=7759;type=HTML Fragment)
2017-06-20 10:26:23,931 DEBUG BaseBrokerProvider - Start decoding.
2017-06-20 10:26:23,931 DEBUG BaseBrokerProvider - End decoding and decompressing 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.