public void testLoadAndStoreWithLifespan() throws Exception {
assertFalse(cl.contains("k"));
long lifespan = 120000;
InternalCacheEntry se = TestInternalCacheEntryFactory.create("k", "v", lifespan);
cl.write(new MarshalledEntryImpl("k", "v", internalMetadata(se), getMarshaller()));
assert cl.contains("k");
MarshalledEntry me = cl.load("k");
assertCorrectExpiry(me, "v", lifespan, -1, false);
me = TestingUtil.allEntries(cl).iterator().next();
assertCorrectExpiry(me, "v", lifespan, -1, false);
lifespan = 1;
se = TestInternalCacheEntryFactory.create("k", "v", lifespan);
cl.write(new MarshalledEntryImpl("k","v", internalMetadata(se), getMarshaller()));
Thread.sleep(100);
purgeExpired();
assert se.isExpired(System.currentTimeMillis());
assertEventuallyExpires("k");
assertFalse(cl.contains("k"));