Can I insert elements having different expiry times like we have in ehcache
For example :
Cache : add element1 //expire after 5 seconds
cache : add element2 //expire after 15 seconds
cache : add element3 //expire after 'x' seconds/minutes
If not, can you suggest any alternative cache to deal with the problem ?
I intended to use ehcache as well but turns out it doesn't support active/eager expiry.
Cache entries have individual expiry policies, use IgniteCache.withExpiryPolicy
:
cache.withExpiryPolicy(new CreatedExpiryPolicy(new Duration(SECONDS, 5))).put(1, 1);
cache.withExpiryPolicy(new CreatedExpiryPolicy(new Duration(SECONDS, 15))).put(2, 2);