We have based our implementation on Clear Sitecore cache for an item from cache programmatically to clear an item from prefetch cache as below
Cache prefetchCache = GetPrefetchCache(Database database);
prefetchCache.RemoveKeysContaining(itemID.ToString());
private Cache GetPrefetchCache(Database database)
{
foreach (var cache in global::Sitecore.Caching.CacheManager.GetAllCaches())
{
if (cache.Name.Contains(string.Format("Prefetch data({0})", database.Name)))
{
return cache;
}
}
}
But the Cache class of 8.2 is modified to ICacheInfo
in 9.2 and RemoveKeysContaining
is not available. Is there any way to remove a particular item from prefetchCache
in 9.2