留言板

How to cache an array of objects using MultiVMPoolUtil and ehcache configur

thumbnail
Rajesh Chaurasia,修改在6 年前。

How to cache an array of objects using MultiVMPoolUtil and ehcache configur

Regular Member 帖子: 183 加入日期: 11-8-18 最近的帖子
Hi

I want to know how i can cache an array of objects into cache and what kind of configuration i need to do in ehcache?

I have done the following and my cache remains for a breif period and expires and i have to again put the objects in cache:

Cache put :
---------------
BusinessUnit[] bu;
try {
		bu = PickupDataUtil.getBusinessUnit();
		MultiVMPoolUtil.getPortalCache(PickupDataConstants.REF_CACHE_NAME).put(PickupDataConstants.CACHE_BU, bu);
		LOG.info("Inside doTaskBusinessUnitCache:Cached BusinessUnit successfully.");
} catch (JSONException e) {
LOG.info("Inside doTaskBusinessUnitCache :JSONException encountered." + e.getMessage());
}



	<cache eternal="false" maxelementsinmemory="100" name="com.tollgroup.mytoll.pickup.pojo.BusinessUnit" overflowtodisk="false" timetoidleseconds="0" timetoliveseconds="178910240">
        <cacheeventlistenerfactory class="com.liferay.portal.cache.cluster.EhcachePortalCacheClusterReplicatorFactory" properties="replicatePuts=true,replicatePutsViaCopy=true,replicateUpdatesViaCopy=true,replicateRemovals=true" propertySeparator="," />
		<bootstrapcacheloaderfactory class="com.liferay.portal.cache.ehcache.LiferayBootstrapCacheLoaderFactory" />
    </cache>
thumbnail
Christoph Rabel,修改在6 年前。

RE: How to cache an array of objects using MultiVMPoolUtil and ehcache conf (答复)

Liferay Legend 帖子: 1554 加入日期: 09-9-24 最近的帖子
Have you tried to specify a TimeToLive in the put method?
PortalCache.put(K key, V value, int timeToLive)

I have only used SingleVMCache so far, but there the parameter works as expected.
thumbnail
Rajesh Chaurasia,修改在6 年前。

RE: How to cache an array of objects using MultiVMPoolUtil and ehcache conf

Regular Member 帖子: 183 加入日期: 11-8-18 最近的帖子
Hi Christoph

Thanks for your revert , i will try this.