ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afedotov <alexander.fedot...@gmail.com>
Subject Re: We want to configure near cache on client so that we can handle high TPS items and avoid network call to server
Date Thu, 31 Aug 2017 13:01:37 GMT
Hi,

1. You can set an eviction policy distinct from the one of the underlying
server cache but you can set a
distinct expiration policy for a near cache as for now; there is, actually,
even no NearCacheConfiguration#setExpiryPolicyFactory method
2. For example, if you have the following configuration for a cache

CacheConfiguration<Integer, Object> cacheConf = ...;
...
cacheConf.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(new
Duration(TimeUnit.SECONDS,5)));

NearCacheConfiguration<Integer, Object> nearConf = new
NearCacheConfiguration<>(); 
nearConf.setNearEvictionPolicy(new LruEvictionPolicy<>(1000)); 

then if an entry which exists in the near cache is updated in the underlying
server cache then
near cache will be notified about it and the expiration policy will take
that fact into account.

If you access 2000 entities within 2 seconds then due to the LRU eviction
policy 1000 of them will be evicted.
If you have 100 entities in the near cache that were accessed 2 seconds ago
and read 500 entities within 3 seconds
then those 100 entities will expire and get removed from the near cache.

Kind regards,
Alex.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Mime
View raw message