掲示板

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

thumbnail
6年前 に Rajesh Chaurasia によって更新されました。

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

Regular Member 投稿: 183 参加年月日: 11/08/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
6年前 に Christoph Rabel によって更新されました。

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

Liferay Legend 投稿: 1554 参加年月日: 09/09/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
6年前 に Rajesh Chaurasia によって更新されました。

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

Regular Member 投稿: 183 参加年月日: 11/08/18 最新の投稿
Hi Christoph

Thanks for your revert , i will try this.