Cache does not expire as given
Even in the demo app, Servicer Side Cache does not expire even I set the duration to a smaller span like 10 seconds. Debug into the code showed that in CheckForExpiredTime method in Microsoft.Extensions.Caching.Memory returns false due to _absoluteExpiration or _slidingExpiration being null.
private bool CheckForExpiredTime(DateTimeOffset now)
{
if (_absoluteExpiration.HasValue && _absoluteExpiration.Value <= now)
{
SetExpired(EvictionReason.Expired);
return true;
}
if (_slidingExpiration.HasValue
&& (now - LastAccessed) >= _slidingExpiration)
{
SetExpired(EvictionReason.Expired);
return true;
}
return false;
}
Hey @dimuthun, I wrote InMemoryCacheOutputProvider in a hurry and just for demo purpose, because on most of my projects I'm using persisted providers. You can try to implement IApiCacheOutput by your own for now. I will try to fix the issue ASAP. Thank you.
@dimuthun, try to download updated version 1.0.5.1 of the AspNetCore.CacheOutput.InMemory package and let me know if anything wrong.
I checked and it works as expected. Thanks!