フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Luca Lupo
[SOLVED] WebContent Cache??
2012/10/03 8:08
答え

Luca Lupo

ランク: Regular Member

投稿: 106

参加年月日: 2012/10/01

最近の投稿

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
Jignesh Vachhani
RE: WebContent Cash??
2012/10/03 4:52
答え

Jignesh Vachhani

ランク: Liferay Master

投稿: 780

参加年月日: 2008/03/10

最近の投稿

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.
Luca Lupo
RE: WebContent Cache??
2012/10/03 5:09
答え

Luca Lupo

ランク: Regular Member

投稿: 106

参加年月日: 2012/10/01

最近の投稿

Thanks a lot Jignesh that worked. Now, the question is: how do I do the cache clearing by code?
Jignesh Vachhani
RE: WebContent Cache??
2012/10/03 5:32
答え

Jignesh Vachhani

ランク: Liferay Master

投稿: 780

参加年月日: 2008/03/10

最近の投稿

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 !!!!
Luca Lupo
RE: WebContent Cash??
2012/10/03 5:24
答え

Luca Lupo

ランク: Regular Member

投稿: 106

参加年月日: 2012/10/01

最近の投稿

In particular, the cache i have to clear is the following:

Clear content cached across the cluster.

Hint?
Luca Lupo
RE: WebContent Cache??
2012/10/03 5:25
答え

Luca Lupo

ランク: Regular Member

投稿: 106

参加年月日: 2012/10/01

最近の投稿

Trying...thanks...I'll let you know
Luca Lupo
RE: WebContent Cache??
2012/10/03 5:33
答え

Luca Lupo

ランク: Regular Member

投稿: 106

参加年月日: 2012/10/01

最近の投稿

clearCache() worked emoticon

Thanksssssss
Jignesh Vachhani
RE: WebContent Cache??
2012/10/03 5:38
答え

Jignesh Vachhani

ランク: Liferay Master

投稿: 780

参加年月日: 2008/03/10

最近の投稿

Luca Lupo:
clearCache() worked emoticon

Thanksssssss


That's awesome . Mark this thread as answered emoticon
Luca Lupo
RE: WebContent Cache??
2012/10/03 8:09
答え

Luca Lupo

ランク: Regular Member

投稿: 106

参加年月日: 2012/10/01

最近の投稿

how?
Ondřej Životský
RE: [SOLVED] WebContent Cache??
2012/10/04 1:57
答え

Ondřej Životský

ランク: Junior Member

投稿: 28

参加年月日: 2011/03/11

最近の投稿

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... ;)
Luca Lupo
RE: [SOLVED] WebContent Cache??
2012/10/04 2:25
答え

Luca Lupo

ランク: Regular Member

投稿: 106

参加年月日: 2012/10/01

最近の投稿

Thanks Ondřej, i will give it a try soon. Now, I'm busy with another thing that might be of interest for you guys (create my own asset publisher). Thus, no extension, but a brand new portlet without writing again the code from the beginning but using the one Asset Publisher uses and modifying that. emoticon