Posted on 29/07/2021 18:44:34
Hi Morten,
I just uncovered possibly a 2nd entity with the same problem. That's: Common.Application.KillProductCategories().
Side note, as I type this, I see 2 things that I'm uncertain of.
- Common.Application.KillProductCategories may be deprecated, and it should use Ecommerce.Services.ProductCategories instead. But I believe it uses the same code, so either should work.
- I really want to clear ProductCategoryFieldValues, however, they are marked as internal in the platform (internal static ProductCategoryFieldGroupValueService), so I don't have access to them directly. So, I was assuming that I could call ClearCache() on ProductCategories and it would take care of the values too. If that's a wrong assumption and there is a correct way to clear ProductCategoryFieldValues, let me know if I'm off track.
Back to the issue ...
That doesn't seem to clear the cache correctly. I believe it's related to this line of code in ServiceCache.cs
foreach (var alternativeCache in AlternativeKeyCaches.Values)
alternativeCache.ClearCache();
I believe that AlternativeKeyCaches doesn't account for all of the cache (as Mário pointed out above). It's just one key. So, when it does the lookup to determine everything to clear, it doesn't get the full list, and therefore the clear doesn't clear everything.
One more bit of evidence of this being a problem is that the Cache tool in the backend always shows 0 items, even for well trafficed sites that we're sure have items in cache:
and
Thanks!
Scott