Exemple #1
0
        /// <inheritdoc/>
        public void RemoveKey(TKey key, bool removeCompletely)
        {
            KeyValuePair <TKey, TItem> oldCached;

            if (deque.TryGetValue(key, out oldCached))
            {
                deque.Remove(key);
                size -= sizeExtractor(oldCached.Value);
                if (chainedCache != null)
                {
                    if (removeCompletely)
                    {
                        chainedCache.RemoveKey(key);
                    }
                    else
                    {
                        chainedCache.Add(oldCached.Value, true);
                    }
                }
                ItemRemoved(key);
            }
        }
Exemple #2
0
        /// <inheritdoc/>
        public override void RemoveKey(TKey key, bool removeCompletely)
        {
            TCached oldCached;

            if (deque.TryGetValue(key, out oldCached))
            {
                deque.Remove(key);
                size -= oldCached.Size;
                if (chainedCache != null)
                {
                    if (removeCompletely)
                    {
                        chainedCache.RemoveKey(key);
                    }
                    else
                    {
                        chainedCache.Add(cacheConverter.ConvertBackward(oldCached), true);
                    }
                }
                ItemRemoved(key);
            }
        }