Remove() abstract private method

abstract private Remove ( string key ) : void
key string
return void
        //
        private void EnsureCacheRemoval(string retrieveKey)
        {
            // The entry can now be replaced as we are not going for cache entry metadata-only  update
            _RequestCache.UnlockEntry(_Validator.CacheStream);

            if (_Validator.StrictCacheErrors)
            {
                _RequestCache.Remove(retrieveKey);
            }
            else
            {
                _RequestCache.TryRemove(retrieveKey);
            }

            // We may need to remove yet another reference from the cache
            if (retrieveKey != _Validator.CacheKey)
            {
                if (_Validator.StrictCacheErrors)
                {
                    _RequestCache.Remove(_Validator.CacheKey);
                }
                else
                {
                    _RequestCache.TryRemove(_Validator.CacheKey);
                }
            }
        }
Exemplo n.º 2
0
        protected virtual void Dispose(bool disposing, CloseExState closeState)
        {
            try {
                if (Interlocked.Increment(ref _Disposed) == 1)
                {
                    if (disposing)
                    {
                        ICloseEx icloseEx = WrappedStream as ICloseEx;

                        if (icloseEx != null)
                        {
                            icloseEx.CloseEx(closeState);
                        }
                        else
                        {
                            WrappedStream.Close();
                        }

                        if (m_CacheDestroy)
                        {
                            if (m_IsStrictCacheErrors)
                            {
                                m_Cache.Remove(m_Key);
                            }
                            else
                            {
                                m_Cache.TryRemove(m_Key);
                            }
                        }
                        else
                        {
                            if (m_IsStrictCacheErrors)
                            {
                                m_Cache.Update(m_Key, m_Expires, m_LastModified, m_LastSynchronized, m_MaxStale, m_EntryMetadata, m_SystemMetadata);
                            }
                            else
                            {
                                m_Cache.TryUpdate(m_Key, m_Expires, m_LastModified, m_LastSynchronized, m_MaxStale, m_EntryMetadata, m_SystemMetadata);
                            }
                        }
                    }
                }
            }
            finally {
                base.Dispose(disposing);
            }
        }