protected virtual int EnumerateCacheEntries(Sitecore.Caching.Cache cache, Action<Sitecore.Caching.Cache.CacheEntry> action) { var keys = cache.GetCacheKeys(); var keyCount = 0; foreach (var key in keys) { var match = true; if (!string.IsNullOrEmpty(KeyName)) match = KeyNamePartial ? key.ToString().Contains(KeyName) : key.ToString().Equals(KeyName); if (match) { var entry = cache.GetEntry(key, false); action(entry); keyCount++; } } return keyCount; }