The Cache DefaultAbsoluteExpireTime property work only once
See original GitHub issueHi suppose cache config is
Configuration.Caching.Configure(CacheNames._roles, cache =>
{
cache.DefaultAbsoluteExpireTime = DateTimeOffset.Now.AddMinutes(1);
});
and laod method is
public async Task<GetUsersToTestCacheOutput> GetUsersToTestCache(GetUsersToTestCacheInput input)
{
string cachKey = AbpSession.UserId.Value.ToString();
var output = new GetUsersToTestCacheOutput();
bool loadedFromCache = true;
output.Data = await CacheManager.GetCache<string, List<NameValueDto>>(CacheNames._roles).GetAsync(cachKey, async () =>
{
loadedFromCache = false;
var d = await (from p in _userRepo.GetAll()
select new
{
p.Id,
p.UserName
}).ToListAsync();
return d.Select(p => new NameValueDto(p.UserName, p.Id.ToString())).ToList();
});
Logger.Info("load data for key " + cachKey + " from " + (loadedFromCache ? "cache" : "DB"));
output.LoadedFromCache = loadedFromCache;
return output;
}
first call at 2022-10-30 10:48:40.803 (data fetched from DB) second call at 2022-10-30 10:49:34.157 (data fetched from cache) third call at 2022-10-30 10:49:34.877 (data fetched from DB) up to this point caching system is working properly forth call at 2022-10-30 10:49:35.247 (data fetch from DB) After that, every request is sent to the method, the information will be fetched from the database.
you can reproduce this step in https://github.com/Omital/TCache and execute TChache.TestConsole project.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Making sure (distributed) caches only store the latest value ...
Hi. · Well, putting the cache aside, if you have two people updating the same entity simultaneously with different values - which one...
Read more >AbpCache sliding/absolute expire time · Issue #5390
Abp Memory Cache creates an absolute expire time using TimeSpan absoluteExpireTime relative to the current time, See.
Read more >Releases · aspnetboilerplate/aspnetboilerplate
TargetNotifiers needs to be virtual in order for NHibernate to proxy it; ISSUE #6492: Bug: The Cache DefaultAbsoluteExpireTime property work only once ...
Read more >Application Data Caching
If several concurrent invocations try to retrieve a cache value from the same missing key, the method will only be invoked once.
Read more >Hybrid Caching unusual amount of redis cache hits #11060
It caches items requested from redis per request. In every request it will be cached locally. When the cache changed in the current...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This can be seen as design.
hi @maliming Thank you, It work with
but what about
DefaultAbsoluteExpireTime
? it has no functionality?