Hi!
First of all thanks for a great package 馃
Version: DoubleCache 2.0.0-beta8 (Nuget).
When calling our API we have a middelware that uses DoubleCache. The idea is to get key from in-memory, then redis and if non then fetch from keyvault. We have set the absolute expiration to 1 minute.
- First run get the value from KeyVault, since the key isn't in in-mem nor redis.
- Saves value (encryptet) to in-mem and redis.
- Second run fetches from in-mem.
- Server restart
- Third run fetches from redis, then save in mem.
- Change secret in KeyVault
- Wait for the absolute expiration (over 1 min)
- Fourth run the in-mem still remembers the old value
Our conclution is that the local memory doesn't respect the expiration value.
string value = await _cache.GetAsync("mykey", async () => await _myService.GetKeyValue(myValue), TimeSpan.FromMinutes(1));
To get the solution to work we had to override the MemoryCache.Default
System.Runtime.Caching.MemoryCache.Default.Set("mykey", value, DateTimeOffset.UtcNow.AddMinutes(1));
So is this a bug or are we using the package wrong?
Thanks!
Hi!
First of all thanks for a great package 馃
Version: DoubleCache 2.0.0-beta8 (Nuget).
When calling our API we have a middelware that uses DoubleCache. The idea is to get key from in-memory, then redis and if non then fetch from keyvault. We have set the absolute expiration to 1 minute.
Our conclution is that the local memory doesn't respect the expiration value.
string value = await _cache.GetAsync("mykey", async () => await _myService.GetKeyValue(myValue), TimeSpan.FromMinutes(1));To get the solution to work we had to override the MemoryCache.Default
System.Runtime.Caching.MemoryCache.Default.Set("mykey", value, DateTimeOffset.UtcNow.AddMinutes(1));So is this a bug or are we using the package wrong?
Thanks!