I'm developing a plugin and noticed some odd behavior with the PerRequestCacheManager
. While doing some testing I realized that it has the same behavior in the base application services which makes me think I'm perhaps misunderstanding it.
(Using stock nopCommerce install with default data)URL
The TopicService calls:
return _cacheManager.Get(key, () => _topicRepository.GetById(topicId));
The PerRequestCacheManager is called and I would expect it to have to query the database the first time and then cache it. Even on subsequent calls of the same URL though it is not returning a cached value. The code below seems to always be skipped as the key does not already exist in cache:
//item already is in cache, so return it
if (items[key] != null)
What am I missing?