留言板

Portlet caching & CacheFilter issue

Bert Willems,修改在14 年前。

Portlet caching & CacheFilter issue

New Member 帖子: 8 加入日期: 09-9-28 最近的帖子
I have a problem disabling the caching of portlets it seems that Liferay caches pages without regarding the caching setting of individual portlets. I have created a simple JSP portlet displaying System.currentTimeMillis().

My portlet.xml:
<expiration-cache>0</expiration-cache>

My liferay-portlet.xml:
<layout-cacheable>false</layout-cacheable>

When I add that portlet to a page it prints a timestamp when I refresh the page the same value is display instead of the new value. When I add a GET parameter to the URL in the first request I get an updated version but with the second request I get the cached page again.

After disabling different caching option I pin pointed the problem to the CacheFilter. When I start Liferay with com.liferay.portal.servlet.filters.cache.CacheFilter=false the problem doesn't occure but when I turn on the CacheFilter the problem occurs.

I use Liferay 5.2.3 running on JBoss 4.2.3, the bundled version without any custom configuration.

I have tried to find a solution for this problem but I can't seem to find it. Can anyone tell me whether I am doing something wrong or is this a bug in Liferay?

Thanks in advance for your replies.
thumbnail
Zsolt Balogh,修改在14 年前。

RE: Portlet caching & CacheFilter issue

Expert 帖子: 463 加入日期: 09-3-23 最近的帖子
I'm curious, could you please attachs your portlet here?
Bert Willems,修改在14 年前。

RE: Portlet caching & CacheFilter issue

New Member 帖子: 8 加入日期: 09-9-28 最近的帖子
Hello Zsolt Balogh,

Thanks for your quick response Zsolt, I really appreciate it.

I have tried to extra the specific portlet to a separate WAR file and add it to a new page. All of a sudden the portlet worked correctly. Next I created a new page and added the portlet from the original WAR to it, again it worked perfectly.

However, when I open the old page I still see the cached version. I can't get the new page to reproduce the exact same behavior.

Please advice on the next step.
thumbnail
Zsolt Balogh,修改在14 年前。

RE: Portlet caching & CacheFilter issue

Expert 帖子: 463 加入日期: 09-3-23 最近的帖子
Was your portlet always layout-cacheable?

Have you tried to restart your portal?
Bert Willems,修改在14 年前。

RE: Portlet caching & CacheFilter issue

New Member 帖子: 8 加入日期: 09-9-28 最近的帖子
It was not, I added that later on.

I have restarted JBoss multiple times and redeployed several times.

I also deleted the exploded WAR file from the deploy directory and cleaned up the work directory.

Could it be that the content is cached in the database? And that dependencies are lost in the process?
Bert Willems,修改在14 年前。

RE: Portlet caching & CacheFilter issue

New Member 帖子: 8 加入日期: 09-9-28 最近的帖子
We have found the cause and the solution for this problem:

The cause was the Liferay Friendly URL cache.

The solution:
1. Open $LIFERAY$\server\default\deploy\ROOT.war\WEB-INF\web.xml in a text editor of choice.
2. Find there definition of Cache Filter – Friendly:
........
<filter>
<filter-name>Cache Filter - Friendly</filter-name>
<filter-class>com.liferay.portal.servlet.filters.cache.CacheFilter</filter-class>
<init-param>
<param-name>pattern</param-name>
<param-value>0</param-value>
</init-param>
</filter>
..........
3. Change the value of pattern to 1
........
<filter>
<filter-name>Cache Filter - Friendly</filter-name>
<filter-class>com.liferay.portal.servlet.filters.cache.CacheFilter</filter-class>
<init-param>
<param-name>pattern</param-name>
<param-value>1</param-value>
</init-param>
</filter>
..........
4. Restart JBoss.
thumbnail
David H Nebinger,修改在9 年前。

RE: Portlet caching & CacheFilter issue

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Don't revive dead threads, G R. Folks normally do not follow their own threads and they probably won't see the posting.

The other thread that you started is still being worked, don't give up on it yet.