<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Liferay cache implementation</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=35520345" />
  <subtitle>Liferay cache implementation</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=35520345</id>
  <updated>2026-06-30T07:23:18Z</updated>
  <dc:date>2026-06-30T07:23:18Z</dc:date>
  <entry>
    <title>RE: Liferay cache implementation</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=35521281" />
    <author>
      <name>Meera Prince</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=35521281</id>
    <updated>2014-03-11T09:59:39Z</updated>
    <published>2014-03-11T09:59:39Z</published>
    <summary type="html">Hi &lt;br /&gt;&lt;br /&gt;I am not sure but liferay already have cache implementation using Ehcache so for each entity we can use cache mechanism &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;the following is info from service builder DTD&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://github.com/liferay/liferay-portal/blob/master/definitions/liferay-service-builder_6_2_0.dtd"&gt;https://github.com/liferay/liferay-portal/blob/master/definitions/liferay-service-builder_6_2_0.dtd&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The cache-enabled value specifies whether or not to cache this queries for this&lt;br /&gt;entity. Set this to false if data in the table will be updated by other&lt;br /&gt;programs. The default value is true&lt;br /&gt;&lt;br /&gt;Relevant properties&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;    # Set the Hibernate cache region factory. Ehcache is recommended in a&lt;br /&gt;    # clustered environment. See the property&lt;br /&gt;    # &amp;#34;net.sf.ehcache.configurationResourceName&amp;#34; for detailed configuration.&lt;br /&gt;    #&lt;br /&gt;    hibernate.cache.region.factory_class=com.liferay.portal.dao.orm.hibernate.region.SingletonLiferayEhcacheRegionFactory&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;    # This property is used if Hibernate is configured to use Ehcache&amp;#39;s region&lt;br /&gt;    # factory.&lt;br /&gt;    #&lt;br /&gt;    net.sf.ehcache.configurationResourceName=/ehcache/hibernate-clustered.xml&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Configure this property if using Ehcache&amp;#39;s default replication method for&lt;br /&gt;    # Hibernate&amp;#39;s region cache.&lt;br /&gt;    #&lt;br /&gt;    net.sf.ehcache.configurationResourceName.peerProviderProperties=peerDiscovery=automatic,multicastGroupAddress=${multicast.group.address[&amp;#34;hibernate&amp;#34;]},multicastGroupPort=${multicast.group.port[&amp;#34;hibernate&amp;#34;]},timeToLive=1&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set other Hibernate cache settings.&lt;br /&gt;    #&lt;br /&gt;    hibernate.cache.use_query_cache=true&lt;br /&gt;    hibernate.cache.use_second_level_cache=true&lt;br /&gt;    hibernate.cache.use_minimal_puts=true&lt;br /&gt;    hibernate.cache.use_structured_entries=false&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Uncomment these properties to disable Hibernate caching.&lt;br /&gt;    #&lt;br /&gt;    #hibernate.cache.use_query_cache=false&lt;br /&gt;    #hibernate.cache.use_second_level_cache=false&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Transactional Cache&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set this property to true to enable transactional cache. When enabled,&lt;br /&gt;    # changes to caches take effect when transaction commits successfully.&lt;br /&gt;    # Caches rollback when transactions rollback.&lt;br /&gt;    #&lt;br /&gt;    transactional.cache.enable=true&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Ehcache&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set the classpath to the location of the Ehcache config file for internal&lt;br /&gt;    # caches. Edit the file specified in the property&lt;br /&gt;    # &amp;#34;ehcache.multi-vm.config.location&amp;#34; to enable clustered cache.&lt;br /&gt;    #&lt;br /&gt;    ehcache.single.vm.config.location=/ehcache/liferay-single-vm.xml&lt;br /&gt;    ehcache.multi.vm.config.location=/ehcache/liferay-multi-vm-clustered.xml&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Uncomment the following in a clustered environment.&lt;br /&gt;    #&lt;br /&gt;    ehcache.multi.vm.config.location.peerProviderProperties=peerDiscovery=automatic,multicastGroupAddress=${multicast.group.address[&amp;#34;multi-vm&amp;#34;]},multicastGroupPort=${multicast.group.port[&amp;#34;multi-vm&amp;#34;]},timeToLive=1&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Input a class name that extends&lt;br /&gt;    # net.sf.ehcache.bootstrap.BootstrapCacheLoaderFactory. This class is used&lt;br /&gt;    # by Ehcache to determine how caches communicate with each other in a&lt;br /&gt;    # clustered environment.&lt;br /&gt;    #&lt;br /&gt;    ehcache.bootstrap.cache.loader.factory=net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory&lt;br /&gt;    #ehcache.bootstrap.cache.loader.factory=com.liferay.portal.cache.ehcache.JGroupsBootstrapCacheLoaderFactory&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Input a class name that extends&lt;br /&gt;    # net.sf.ehcache.event.CacheEventListenerFactory. This class is used by&lt;br /&gt;    # Ehcache to determine how caches communicate with each other in a clustered&lt;br /&gt;    # environment.&lt;br /&gt;    #&lt;br /&gt;    ehcache.cache.event.listener.factory=net.sf.ehcache.distribution.RMICacheReplicatorFactory&lt;br /&gt;    #ehcache.cache.event.listener.factory=net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Input a class name that extends&lt;br /&gt;    # net.sf.ehcache.distribution.CacheManagerPeerProviderFactory. This class is&lt;br /&gt;    # used by Ehcache to determine how caches communicate with each other in a&lt;br /&gt;    # clustered environment.&lt;br /&gt;    #&lt;br /&gt;    ehcache.cache.manager.peer.provider.factory=net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory&lt;br /&gt;    #ehcache.cache.manager.peer.provider.factory=net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set this to true to enable JMX integration in&lt;br /&gt;    # com.liferay.portal.cache.EhcachePortalCacheManager. Set this to false if&lt;br /&gt;    # the portal needs to be reloaded under WebSphere.&lt;br /&gt;    #&lt;br /&gt;    ehcache.portal.cache.manager.jmx.enabled=true&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set this to true to allow Ehcache to use blocking caches. This improves&lt;br /&gt;    # performance significantly by locking on keys instead of the entire cache.&lt;br /&gt;    # The drawback is that threads can hang if the cache is not used properly.&lt;br /&gt;    # Make sure that all queries that return a miss also immediately populate&lt;br /&gt;    # the cache, or else other threads that are blocked on a query of that same&lt;br /&gt;    # key will continue to hang. Reference Ehcache&amp;#39;s BlockingCache for more&lt;br /&gt;    # information. The blocking cache is no longer implemented by Ehcache&amp;#39;s&lt;br /&gt;    # BlockingCache, but by Liferay&amp;#39;s BlockingPortalCache for better safety and&lt;br /&gt;    # faster performance.&lt;br /&gt;    #&lt;br /&gt;    ehcache.blocking.cache.allowed=true&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set this to true to enable Ehcache statistics.&lt;br /&gt;    #&lt;br /&gt;    ehcache.statistics.enabled=false&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;    # Value objects are cached at three levels. They first level is &amp;#34;entity&amp;#34;,&lt;br /&gt;    # the second level is &amp;#34;finder&amp;#34;, and the third level is &amp;#34;Hibernate&amp;#34;.&lt;br /&gt;    #&lt;br /&gt;    # The entity level cache stores a value object&amp;#39;s primary key to the value&lt;br /&gt;    # object itself.&lt;br /&gt;    #&lt;br /&gt;    # The finder level cache stores the many paths that return a&lt;br /&gt;    # value object and the many paths that return a list of value objects. The&lt;br /&gt;    # finder level cache only caches primary keys and is further helped by the&lt;br /&gt;    # entity level cache that caches the value object to the primary key.&lt;br /&gt;    #&lt;br /&gt;    # The Hibernate level cache is provided by the&lt;br /&gt;    # &amp;#34;hibernate.cache.provider_class&amp;#34; property.&lt;br /&gt;    #&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set this to true to enable entity level caching.&lt;br /&gt;    #&lt;br /&gt;    value.object.entity.cache.enabled=true&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set this to true to configure entity level caching to block. See the&lt;br /&gt;    # property &amp;#34;ehcache.blocking.cache.allowed&amp;#34; for more information.&lt;br /&gt;    #&lt;br /&gt;    value.object.entity.blocking.cache=true&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # The entity level cache uses a thread local map to store the most&lt;br /&gt;    # frequently accessed items to lower the number of queries to the underlying&lt;br /&gt;    # cache. Set the maximum map size to 0 to disable the thread level cache.&lt;br /&gt;    #&lt;br /&gt;    value.object.entity.thread.local.cache.max.size=100&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Entity level caching for a specific type of value object can be configured&lt;br /&gt;    # by using a property name that includes the value object&amp;#39;s class name.&lt;br /&gt;    #&lt;br /&gt;    value.object.entity.cache.enabled.com.liferay.portal.model.Layout=true&lt;br /&gt;    value.object.entity.cache.enabled.com.liferay.portal.model.User=true&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set this to true to enable finder level caching.&lt;br /&gt;    #&lt;br /&gt;    value.object.finder.cache.enabled=true&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Set this to true to configure finder level caching to block. See the&lt;br /&gt;    # property &amp;#34;ehcache.blocking.cache.allowed&amp;#34; for more information.&lt;br /&gt;    #&lt;br /&gt;    value.object.finder.blocking.cache=true&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # The finder level cache uses a thread local map to store the most&lt;br /&gt;    # frequently accessed items to lower the number of queries to the underlying&lt;br /&gt;    # cache. Set the maximum map size to 0 to disable the thread level cache.&lt;br /&gt;    #&lt;br /&gt;    value.object.finder.thread.local.cache.max.size=100&lt;br /&gt;&lt;br /&gt;    #&lt;br /&gt;    # Finder level caching for a specific type of value object can be configured&lt;br /&gt;    # by using a property name that includes the value object&amp;#39;s class name.&lt;br /&gt;    # Mapping tables can also be specified to configure the caching of value&lt;br /&gt;    # object relationships.&lt;br /&gt;    #&lt;br /&gt;    value.object.finder.cache.enabled.com.liferay.portal.model.Layout=true&lt;br /&gt;    value.object.finder.cache.enabled.com.liferay.portal.model.User=true&lt;br /&gt;    value.object.finder.cache.enabled.Users_Roles=true&lt;br /&gt;Relevant links&lt;br /&gt;&lt;a href="https://www.liferay.com/documentation/liferay-portal/6.0/administration/-/ai/distributed-cachi-4"&gt;https://www.liferay.com/documentation/liferay-portal/6.0/administration/-/ai/distributed-cachi-4&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://www.liferay.com/community/wiki/-/wiki/Main/ehCache+Configuration"&gt;https://www.liferay.com/community/wiki/-/wiki/Main/ehCache+Configuration&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.apoorvaprakash.in/2012/03/liferay-cache-key-to-improve.html"&gt;http://www.apoorvaprakash.in/2012/03/liferay-cache-key-to-improve.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.xtivia.com/home/-/blogs/caching-observations-in-liferay-6"&gt;http://blogs.xtivia.com/home/-/blogs/caching-observations-in-liferay-6&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://liferayzone.wordpress.com/2012/06/15/liferay-ehcache-configuration-distributed-caching-in-liferay/"&gt;https://liferayzone.wordpress.com/2012/06/15/liferay-ehcache-configuration-distributed-caching-in-liferay/&lt;/a&gt;&lt;br /&gt;&lt;a href="https://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Liferay+Caching"&gt;https://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Liferay+Caching&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Meera Prince</summary>
    <dc:creator>Meera Prince</dc:creator>
    <dc:date>2014-03-11T09:59:39Z</dc:date>
  </entry>
  <entry>
    <title>Liferay cache implementation</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=35520344" />
    <author>
      <name>Nitin Yeola</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=35520344</id>
    <updated>2014-03-11T09:46:56Z</updated>
    <published>2014-03-11T09:46:56Z</published>
    <summary type="html">Hi,&lt;br /&gt;I would like to know Liferay cache system.&lt;br /&gt;I have to get all liferay users along with social equity points and save them in cache( suppose 70,000 users).&lt;br /&gt;External systems use web service to get x(5000) number of users details,then it should fetch data from cache and return back.&lt;br /&gt;&lt;br /&gt;Can anybody suggests me how can i implement caching for the above scenario?</summary>
    <dc:creator>Nitin Yeola</dc:creator>
    <dc:date>2014-03-11T09:46:56Z</dc:date>
  </entry>
</feed>
