DefaultCacheStorageProvider.Set() should read (where _clock is an injected IClock):
new TimeSpan(0, 0, cacheItem.ValidFor),
The fixed version caches the item for the amount of time configured (and also the entry is removed from the cache automatically when it expires without an access to it) by using absolute expiration.
The original version uses sliding expiration for the given amount of time. This means that the entry will expire if it is not
for the given amount of time. I.e. if expiration time is one minute but the page is accessed every 30 seconds it will never expire (until anything else clears it from the cache).
The above is also a fix for
Am I missing something?