Liferay.com

Friday, July 22, 2011

Entity caching disabling - custom portlet

In some cases we need to disable caching for some Entities in Liferay according to requirements. In one of my project i got a requirement where i got this use case for my plugin portlet


By default Liferay caches all the entities.

First Option : One way to do it is, at entity level in service.xml set cache-enabled attribute to false as below

    <entity name="MyModelEntity" table="MyModelEntity" local-service="true" remote-service="true" cache-enabled="false">

Second option:  You can disable the same @ portlet level by setting following properties, in your portal.properties underr src folder of your portlet plugin add following porperties (I am not pretty much sure about below one)

value.object.entity.cache.enabled.com.xyz.abc.common.model.MyModelEntity=false;
value.object.finder.cache.enabled.com.xyz.abc.common.model.MyModelEntity=false;

Colored in blue is path to your model entity

I hope it will helpful for some who is looking for similar stuff.

Please feel free to drop your comments

4 comments:

  1. I tried doing this but the cache still doesnt clear in my browser.

    ReplyDelete
  2. Which option did you try first one/second one?

    What was your Liferay version

    ReplyDelete