Absolute expiration instead of sliding expiration?
Hey, I'm playing around with the dictionary cache and have configured it using ExpireAfter.
It looks like this configures it to use sliding expiration. Is absolute expiration supported? If so, how would I set the absolute expiration TimeSpan?
Absolute expiration isn't supported natively because some cache providers don't inherently support it. You can get the desired results by specifying a validation callback - but keep in mind that this will be run client-side.
Alternatively, you can specify a sliding expiration based on (absolute_expiration - now)
Okay thanks, I will explore those options. My (limited) understanding is that most caching providers support this type of functionality (IDistributedCache, IMemoryCache, Redis, etc.) so would be helpful if this were included in future releases. Thanks for your help and for the great library!
I'll look into the absolute expiration. Now that I think about it, I used to support it and took it out. I'll have to see why I removed it.