]
Galder Zamarreño updated ISPN-8841:
-----------------------------------
Stackoverflow ID: 48803903
JCache does not respect when ttl is null
----------------------------------------
Key: ISPN-8841
URL:
https://issues.jboss.org/browse/ISPN-8841
Project: Infinispan
Issue Type: Bug
Components: JCache
Affects Versions: 9.2.0.CR2
Reporter: Radim Vansa
JCache does not respect {{ttl = null}} when updating an entry; {{view.set(value);}}
resets entry lifespan to default value set in Infinispan configuration (immortal).
{code}
public void testPutPut(Method m) {
final MutableConfiguration<Integer, String>
cfg = new MutableConfiguration<Integer, String>();
cfg.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new
Duration(TimeUnit.SECONDS, 1)));
final String name = getName(m);
withCachingProvider(provider -> {
CacheManager cm = provider.getCacheManager();
Cache<Integer, String> cache = cm.createCache(name, cfg);
cache.put(1, "v1");
assertTrue(cache.containsKey(1));
assertEquals("v1", cache.get(1));
try {
Thread.sleep(1100);
} catch (InterruptedException e) {
assert false;
}
assertEquals(null, cache.get(1));
cache.put(1, "v2");
cache.put(1, "v3");
try {
Thread.sleep(1100);
} catch (InterruptedException e) {
assert false;
}
assertEquals(null, cache.get(1));
});
}
{code}