3 Replies Latest reply on Nov 7, 2008 8:28 AM by danielk

    Portlet Caches Expiration Doesn't appear to work...

      In the JSP that I use to render the portlet's content, it appears that the portal caches the generated JSP. The portlet is used to provide a customized search functionality, so if the user refreshes the page, it should display the default state of the search form and not the previous search results.

      I have tried to set the expiration cache value in the portlet.xml file for my portlet as such:

      <expiration-cache>0</expiration-cache>


      ( By the way the JSR 286 spec states 0 should be the default value for the expiration-cache value...see PLT.22.1 Expiration Cache)


      I have also tried to programatically expire the cache using the following code snippet in my doView() method, as such:

      response.setProperty( RenderResponse.EXPIRATION_CACHE, "0" );


      It is most certainly a caching problem, because it I wait for a significant amount of time and I refresh the portal page, the cached JSP is refreshed to the default state.

      Am I doing something wrong here, or is there a known bug that I'm not aware of?

      Thanks for any input that can be provided


        • 1. Re: Portlet Caches Expiration Doesn't appear to work...

          Any ideas, anyone???

          • 2. Re: Portlet Caches Expiration Doesn't appear to work...
            prabhat.jha

            Would you be able to provide a war for us to test? You can send that to me in email: pjha AT redhat DOT com. Also which jboss portal version are you using?

            • 3. Re: Portlet Caches Expiration Doesn't appear to work...
              danielk

              Prabhat can you please give a short explanation, if expiration-cache should do what analyzediz described? Is it true that expiration-cache set to 0 should give a behaviour, where each call to that portlet will return a "fresh" new portlet instance?

              Perhaps he (and i) misunderstood something? Another point, in exampled is see this setting will be set to -0. Is there a difference between 0 and -0 ??? I hope 0 = -0, but perhaps i am wrong ...

              Thanks for answering,

              DanielK

              PS:
              - JBoss Portal 2.6.5 GA
              - Richfaces 3.2.2 GA
              - PortletBridge B4
              - Part from http://www.scribd.com/doc/4857633/portlet1-0prdspec:

              A portlet that has defined an expiration cache in its portlet definition mayprogrammatically alter the expiration time by setting the expiration-cache property in the RenderResponse object. If the expiration value is set to 0, caching is disabled for the 25portlet. If the expiration-cache property is set to -1, the cache does not expire. If during a render invocation the expiration-cache property is not set, the expirationtime defined in the deployment descriptor must be used. For a portlet that has not definedexpiration cache in the deployment descriptor, if the expiration-cache property is set itmust be ignored by the portlet-container.