Get the TTL at runtime with infinispan

infinispan

Solution

To get the configuration of lifespan for entire cache, you can use:

cache.getCacheConfiguration().expiration().lifespan();

and to obtain lifespan for specific entry, you can use:

cache.getAdvancedCache().getCacheEntry("key").getLifespan();

Hope that helps!

Problem

I am using the Infinispan cache. Is there any way to get the TTL (or lifepsan) of entries at runtime? I see the interface `CacheEntry` as a `getLifespan()` API but I don't see how to get a handle on CacheEntry interface, Thanks

Original source