Disabling cache in liferay

    ##
    ## Browser Cache
    ##

    #
    # Set this to true if you want the portal to force the browser cache to be
    # disabled. It will only disable the cache for the rendered HTML response
    # It will not have an impact on static content or other resources.
    #
    #browser.cache.disabled=true

Add above parameter in portal-ext.properties .The above parameter ensures browser never cache the results.

What liferay is doing internally to disable cache? Here we go,

Have look at the ServicePreAction class , this ServicePreAction class excutes for every request



if (PropsValues.BROWSER_CACHE_DISABLED ||(PropsValues.BROWSER_CACHE_SIGNED_IN_DISABLED && signedIn)) {

                response.setDateHeader(HttpHeaders.EXPIRES, 0);
                response.setHeader(HttpHeaders.CACHE_CONTROL,
                               HttpHeaders.CACHE_CONTROL_NO_CACHE_VALUE);
                response.setHeader( HttpHeaders.PRAGMA,
                            HttpHeaders.PRAGMA_NO_CACHE_VALUE);

  }

Comments

  1. Is this true with liferay version 6.0.5?

    ReplyDelete
    Replies
    1. It is also works with the 6.0.5. It is not working??

      Delete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate