Search code examples
spring-bootredisgemfirespring-data-gemfiregeode

Is it possible to expire data of specific key from gemfire region like redis


Hi I am new to gemfire and i want to exprire data from gemfire region for specific key after idle time which I set.

i did this using redis by below code.

jedis.set(key, value);
config.setMaxIdle(50);
jedis.expire(key, config.getMaxIdle());

but how to do it in gemfire.

Any help.

Thanks.


Solution

  • If you want to delete data for specific region then try following code :

    Region<String, String> region = cache .<String, String> createClientRegionFactory( ClientRegionShortcut.CACHING_PROXY) .setEntryTimeToLive(new ExpirationAttributes(50)) .create(PropertiesCache.getInstance().getProperty("region"));
    

    It's works in my situation.