/// <summary> /// Remove a value from the cache for specified key. /// </summary> /// <typeparam name="TKey">The type of the key.</typeparam> /// <param name="key">The key.</param> public void Remove <TKey>(TKey key) { if (!Equals(key, null)) { CacheItem cacheItem; _cache.TryRemove(key, out cacheItem); SlidingDetails slidingDetails; _slidingTime.TryRemove(key, out slidingDetails); KeyRemoved?.Invoke(key, new EventArgs()); } }
public void Remove(string name) { bool notify = false; lock (itemsLock) { if (items.ContainsKey(name)) { notify = true; items.Remove(name); } } if (notify) { KeyRemoved?.Invoke(name); } }