留言板
[SOLVED] WebContent Cache??
Hi Guys,
I have created a plugin Ext to extend the core's action that "display/render" a web content in Liferay.
com.liferay.portlet.journalcontent.action.ViewAction
The purpose is to allow end users to insert special tag in the web content (for example, <username />) and to render those tags with specific values (for username the username of the real user in the portal).
I believe I have a problem in the port let/webcontent cache. Basically, If another user (let's say Paul) accesses the portal after a first user (let's say Luca) already accessed, the portal renders the web content with the tag <username /> set to Luca instead of <username /> (so i can detect it and change with Paul).
So it's like life ray is reusing the portlet web content from a sort of cache instead of taking it from the DB again and clean.
Any hint?
Luca
I have created a plugin Ext to extend the core's action that "display/render" a web content in Liferay.
com.liferay.portlet.journalcontent.action.ViewAction
The purpose is to allow end users to insert special tag in the web content (for example, <username />) and to render those tags with specific values (for username the username of the real user in the portal).
I believe I have a problem in the port let/webcontent cache. Basically, If another user (let's say Paul) accesses the portal after a first user (let's say Luca) already accessed, the portal renders the web content with the tag <username /> set to Luca instead of <username /> (so i can detect it and change with Paul).
So it's like life ray is reusing the portlet web content from a sort of cache instead of taking it from the DB again and clean.
Any hint?
Luca
You can give a try by clearing DB cache from liferay control panel.
Hopw this will resolve and if still issue persist , please post your some of code here which can help to understand the exact thing.
Hopw this will resolve and if still issue persist , please post your some of code here which can help to understand the exact thing.
Thanks a lot Jignesh that worked. Now, the question is: how do I do the cache clearing by code?
Luca Lupo:
Thanks a lot Jignesh that worked. Now, the question is: how do I do the cache clearing by code?
You can use JournalContentUtil.clearCache() OR JournalContentUtil.clearCache(groupId, articleId, templateId);
Hope this will work !!!!
Hi,
you choosed solution which works, It´s great...
One little note - Liferay has better solution for your requirement. It is transformer. You can create EXT plugin with MyPlaceholders class and register it in portal-ext.properties (key journal.transformer.listener - add your class to the end). MyPlaceholders class can extend BaseTransformerListener and easily modify WebContent before it is shown. So you don't need to modify Liferay classes. But I'm not exactly sure how cache works here... ;)
you choosed solution which works, It´s great...
One little note - Liferay has better solution for your requirement. It is transformer. You can create EXT plugin with MyPlaceholders class and register it in portal-ext.properties (key journal.transformer.listener - add your class to the end). MyPlaceholders class can extend BaseTransformerListener and easily modify WebContent before it is shown. So you don't need to modify Liferay classes. But I'm not exactly sure how cache works here... ;)