Liferay page cache problem solved

The original text is from  http://www.blogjava.net/kennyr/articles/214440.html?opt=admin

The cache problem of the liferay page has puzzled me for a long time. I don't know if this method is effective, so I will copy it here first.

 

Liferay page cache problem solved

  Liferay pages use cache. When not logged in, the page is loaded only once. Even if the JSP file is modified, the page sometimes cannot be reloaded. But after logging in, it reloads every time every page is requested. I checked a lot of information on the Internet, and using those methods works for general JSP pages, but it does not work for Liferay.
  After research, it is found that Liferay cache is realized by filter, namely com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter, there are corresponding settings in system.properties, com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter =false, the server will be re-requested every time.

Quickly do as he said, and found that it is not reflected. The research found that this is only a setting for the development environment. So find
web.xml in the Tomcat directory (D:\lifeportal\tomcat\webapps\ROOT\WEB-INF), open it and modify it as follows
:
<filter>
        <filter-name>Layout Cache Filter - Friendly</filter- name>
        <filter-class>com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter</filter-class>
        <init-param>
            <param-name>pattern</param-name>
            <param-value>0< /param-value>
        </init-param>
    </filter>

        <filter-name>Layout Cache Filter - Layout</filter-name>
        <filter-class>com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter</filter-class>
        <init-param>
            <param-name>pattern</param-name>
            <param-value>1</param-value>
        </init-param>
    </filter>
    <filter>
        <filter-name>Layout Cache Filter - Resource</filter-name>
        <filter-class>com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter</filter-class>
        <init-param>
            <param-name>pattern</param-name>
            <param-value>2</param-value>
        </init-param>
    </filter>

改为:<filter>
        <filter-name>Layout Cache Filter - Friendly</filter-name>
        <filter-class>com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter</filter-class>
        <init-param>
            <param-name>pattern</param-name>
             <param-value>0</param-value>
        </init-param>
    </filter>
    <filter>
        <filter-name>Layout Cache Filter - Layout</filter-name>
        <filter-class>com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter</filter-class>
        <init-param>
            <param-name>pattern</param-name>
             <param-value>0</param-value>
        </init-param>
    </filter>
    <filter>
        <filter-name>Layout Cache Filter - Resource</filter-name>
        <filter-class>com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter</filter-class>
        <init-param>
            <param-name>pattern</param-name>
             <param-value>0</param-value>
        </init-param>
    </filter>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326844178&siteId=291194637