Update expiry length of ignite cache

42 Views Asked by At

Is there any way to update the expiry legnth for a cache that is already created in ignite? like I create this cache and set expiry policy as 5-day length, after some time I want to make the cache expiry policy to 10-day length.

I prefer to not destroy the cache and recreate it, since the data will be lost if doing so.

1

There are 1 best solutions below

0
Stephen Darlington On

Unfortunately you can't update the default expiry time, but you can set the TTL for each row individually:

        var table = ignite.cache("MY_CACHE");
        table.withExpiryPolicy(new CreatedExpiryPolicy(Duration.FIVE_MINUTES))
                .put(1L, 2.0d);
        table.withExpiryPolicy(new TouchedExpiryPolicy(Duration.ONE_HOUR))
                .put(2L, 4.0d);