Vincent Y
Vincent Y

Reputation: 119

Update expiry length of ignite cache

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.

Upvotes: 1

Views: 123

Answers (1)

Stephen Darlington
Stephen Darlington

Reputation: 52565

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);

Upvotes: 0

Related Questions