private void MoveCacheItem(ICacheMedium from, ICacheMedium to, CacheKey key, CacheValue value) { if (this.logger != null) { this.logger.Log("Move cache item: " + key.ToString() + " from " + from.CacheName + " to " + to.CacheName, Category.Info, Priority.Medium); } from.Remove(key); to.Set(key, value); }
private void ReplaceItemsIfNecessary(ICacheMedium medium) { CacheKey[] items = medium.Replace(); if (items == null) { return; } ICacheMedium next = medium.Next(); if (next != null) { foreach (CacheKey item in items) { // set the cache item to next medium next.Set(item, medium.Get(item)); } } foreach (CacheKey item in items) { // remove the cache item from previous medium medium.Remove(item); } }