@Override
public InternalCacheEntry create(Object key, Object value, Metadata metadata) {
long lifespan = metadata.lifespan();
long maxIdle = metadata.maxIdle();
if (!isStoreMetadata(metadata)) {
if (lifespan < 0 && maxIdle < 0) return new ImmortalCacheEntry(key, value);
if (lifespan > -1 && maxIdle < 0) return new MortalCacheEntry(key, value, lifespan, timeService.wallClockTime());
if (lifespan < 0 && maxIdle > -1) return new TransientCacheEntry(key, value, maxIdle, timeService.wallClockTime());
return new TransientMortalCacheEntry(key, value, maxIdle, lifespan, timeService.wallClockTime());
} else {
if (lifespan < 0 && maxIdle < 0) return new MetadataImmortalCacheEntry(key, value, metadata);