Hi Stan
Thank you for the quick reply.
Let me clarify my use case: I want to have expiration for all regular
operations.
Along with that, I want to be able to read some or all entries without
refreshing TTLs, for example for debugging.
Following your example, I create a view with expiration and a view without
it, my understanding is that accessing through the view with
EternalExpiryPolicy shouldn't refresh TTLs - which seems to work.
However, accessing through the view with TouchedExpiryPolicy doesn't seem
to refresh TTLs.
Do you think something like that should work?
// Auto-close cache at the end of the example.
try (IgniteCache<String, String> cache =
ignite.getOrCreateCache(CACHE_NAME)) {
// create not expiring view
IgniteCache<String, String> bypassCache =
cache.withExpiryPolicy(new EternalExpiryPolicy());
// create expiring view, 10 seconds TTL
System.out.println(">>> Set entries to expire in 10
seconds");
IgniteCache<String, String> workCache =
cache.withExpiryPolicy(new TouchedExpiryPolicy(new
Duration(TimeUnit.SECONDS, 10)));
// entries shouldn't survive
populate(workCache);
sleep(5); // sleep for 5 seconds
System.out.println("\n>>> Dump cache, don't refresh TTL");
getAll(bypassCache);
sleep(5);
System.out.println("\n>>> Work cache should be empty");
getAll(workCache);
System.out.println("\n>>> Bypass cache should be empty");
getAll(bypassCache);
// entries should survive
populate(workCache);
sleep(5);
System.out.println("\n>>> Dump cache, refresh TTL"); //
entries are still there
getAll(workCache);
sleep(5);
System.out.println("\n>>> Bypass cache should be not
empty"); // entries are gone
getAll(bypassCache);
System.out.println("\n>>> Work cache should be not empty");
getAll(workCache);
...
Ariel
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/