Fórumok

How to implement hibernate second level cache in Liferay 6.2

satish mandava, módosítva 9 év-val korábban

How to implement hibernate second level cache in Liferay 6.2

New Member Bejegyzések: 11 Csatlakozás dátuma: 2014.04.21. Legújabb bejegyzések
Hi,

I want to implement hibernate second level cache for my custom portlets.
I am using liferay 6.2. For this i have created a hook to override the existing portal.properties.
i have written the ehcache scenario. I got the below xml files from portal-impl.jar
portal.properties.
ehcache.multi.vm.config.location=/xml/liferay-multi-vm-clustered.xml
ehcache.single.vm.config.location=/xml/liferay-single-vm.xml
net.sf.ehcache.configurationResourceName=/xml/hibernate-clustered.xml

------XMl is folder name.


And i have added the below code in liferay-single-vm.xml

<cache
eternal="false"
maxElementsInMemory="50"
name="com.meera.liferay.spring.domain.Contact"
overflowToDisk="false"
timeToIdleSeconds="30"
/>

I have tried to get the contacts list, every time it is hitting the database. it is not fetching the data from cache.

Is it correct or i had missed any thing. Can you please help met how to implement second level cache.

Thanks,
Satish
satish mandava, módosítva 9 év-val korábban

RE: How to implement hibernate second level cache in Liferay 6.2

New Member Bejegyzések: 11 Csatlakozás dátuma: 2014.04.21. Legújabb bejegyzések
satish mandava:
Hi,

I want to implement hibernate second level cache for my custom portlets.
I am using liferay 6.2. For this i have created a hook to override the existing portal.properties.
i have written the ehcache scenario. I got the below xml files from portal-impl.jar
portal.properties.
ehcache.multi.vm.config.location=/xml/liferay-multi-vm-clustered.xml
ehcache.single.vm.config.location=/xml/liferay-single-vm.xml
net.sf.ehcache.configurationResourceName=/xml/hibernate-clustered.xml

------XMl is folder name.


And i have added the below code in liferay-single-vm.xml

<cache
eternal="false"
maxElementsInMemory="50"
name="com.meera.liferay.spring.domain.Contact"
overflowToDisk="false"
timeToIdleSeconds="30"
/>

I have tried to get the contacts list, every time it is hitting the database. it is not fetching the data from cache.

Is it correct or i had missed any thing. Can you please help met how to implement second level cache.

Thanks,
Satish



can any one please do needful...
thumbnail
Meera Prince, módosítva 9 év-val korábban

RE: How to implement hibernate second level cache in Liferay 6.2

Liferay Legend Bejegyzések: 1111 Csatlakozás dátuma: 2011.02.08. Legújabb bejegyzések
Hi
Have a look into following portlet source code you may get some idea

https://github.com/liferay/liferay-plugins/tree/master/portlets/test-cache-configuration-portlet


Also see following properties

#
# Entity level caching for a specific type of value object can be configured
# by using a property name that includes the value object's class name.
#
value.object.entity.cache.enabled.com.liferay.portal.model.Layout=true
value.object.entity.cache.enabled.com.liferay.portal.model.User=true


try to add following is service.properties

value.object.entity.cache.enabled.com.meera.liferay.spring.domain.Contact=true


Try above ways..


Regards,
Meera Prince