0
votes

I am using Apache Ignite 2.8.0. I see that when persistence is enabled, cache expiry is not working. But according to documentation it should: https://apacheignite.readme.io/docs/expiry-policies.

I am using Java Thin client. How can I set expire policy for my thin client cache, when persistence is enabled? and whether thin client cache supports the expire polices or not?

1

1 Answers

0
votes

Thin client doesn't support creating a cache w/expiry policies.

see: https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/client/ClientCacheConfiguration.html

You can create a cache with expiry via config on a server or a thick client and then use that same cache in the thin client.

i.e.

on the server/thick client:

    CacheConfiguration cacheCfg = new CacheConfiguration("expiringCache");

    cacheCfg.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 10)));

on thin client:

    IgniteClient igniteClient = Ignition.startClient(cfg)
    ClientCache cache  = igniteClient.cache("expiringCache");

Anything put into this cache will expire in 10 seconds.