Hello,
By
default all the cache objects specified in the liferay-multi-vm-clustered.xml
or in the liferay-single-vm.xml are set to default idle time out for 600
seconds (5 mins). Which means if a key in the cahe is not accessed for 5
minutes will be removed from the cache.
If you want to extends the time out or want to add
your your own cache you can follow the below steps.
I
am doing it for the liferay-multi-vm-clustered.xml
1. Goto
liferay-portal-6.2-ee-sp10\tomcat-7.0.42\webapps\ROOT\WEB-INF\classes
2. Inside the classes
create a folder, i have created a folder with the name ehcache.
3. Now copy
liferay-multi-vm-clustered.xml file from the portal source. If you don't have
the poral source code available with you, you can download it from here.
4. Rename the file to
your desired name, lets say custom-liferay-multi-vm-clustered.xml
5. Edit the file and add
the below entry.
eternal="true"
maxElementsInMemory="10000"
name="testCache"
overflowToDisk="false"
timeToIdleSeconds="0"
>
class="com.liferay.portal.cache.ehcache.LiferayCacheEventListenerFactory"
properties="replicatePuts=false,replicateUpdatesViaCopy=false"
propertySeparator=","
/>
6. Now copy the modified
file into the location liferay-portal-6.2-ee-sp10\tomcat-7.0.42\webapps\ROOT\WEB-INF\classes\ehcache
7. In the
portal-ext.properties which is inside liferay-portal-6.2-ee-sp10 folder add
this entry ehcache.multi.vm.config.location=/ehcache/ custom -liferay-multi-vm-clustered.xml
8. Now restart the
server.
If you
observe the entry the highlighted are the changes we made.
Making the eternal=”true”
makes the elements in the cache to never expire.
These will stay in the cache
until you restart the server.
Changed timeToIdleSeconds=”0”
Comments