private void CacheItemRemoved(CacheEntryRemovedArguments arguments) { var item = arguments.CacheItem; var args = new MicroCacheItemRemovedEventArgs <T>(item.Key, ((LazyLock)item.Value).Get <T>(null)); OnCacheItemRemoved(args); }
protected virtual void OnCacheItemRemoved(MicroCacheItemRemovedEventArgs <T> e) { if (this.ItemRemoved != null) { ItemRemoved(this, e); } }
protected virtual void cacheProvider_ItemRemoved(object sender, MicroCacheItemRemovedEventArgs <T> e) { // Skip the event if the item is null, empty, or otherwise a default value, // since nothing was actually put in the cache, so nothing was removed if (!EqualityComparer <T> .Default.Equals(e.Item, default(T))) { // Cascade the event OnCacheItemRemoved(e); } }
/// <summary> /// This method is called when an item has been removed from the cache. /// </summary> /// <param name="key">Cached item key.</param> /// <param name="item">Cached item.</param> /// <param name="reason">Reason the cached item was removed.</param> protected virtual void OnItemRemoved(string key, object item, CacheItemRemovedReason reason) { var args = new MicroCacheItemRemovedEventArgs <T>(key, ((LazyLock)item).Get <T>(null)); OnCacheItemRemoved(args); }
private void cacheProvider_ItemRemoved(object sender, MicroCacheItemRemovedEventArgs <T> e) { // Cascade the event OnCacheItemRemoved(e); }