System.Web.Caching.OutputCache.RemoveFromProvider C# (CSharp) Method

RemoveFromProvider() static private method

static private RemoveFromProvider ( string key, string providerName ) : void
key string
providerName string
return void
		internal static void RemoveFromProvider (string key, string providerName)
		{
			if (providerName == null)
				return;

			OutputCacheProviderCollection providers = Providers;
			OutputCacheProvider provider;
			
			if (providers == null || providers.Count == 0)
				provider = null;
			else
				provider = providers [providerName];

			if (provider == null)
				throw new ProviderException ("Provider '" + providerName + "' was not found.");

			provider.Remove (key);
		}
	}

Usage Example

Example #1
0
        // only used by providers
        private static void DependencyRemovedCallback(string key, object value, CacheItemRemovedReason reason)
        {
            Debug.Trace("OutputCache", "DependencyRemovedCallback: reason=" + reason + ", key=" + key);

            DependencyCacheEntry dce = value as DependencyCacheEntry;

            if (dce.KernelCacheEntryKey != null)
            {
                // invalidate kernel cache entry
                if (HttpRuntime.UseIntegratedPipeline)
                {
                    UnsafeIISMethods.MgdFlushKernelCache(dce.KernelCacheEntryKey);
                }
                else
                {
                    UnsafeNativeMethods.InvalidateKernelCache(dce.KernelCacheEntryKey);
                }
            }
            if (reason == CacheItemRemovedReason.DependencyChanged)
            {
                if (dce.OutputCacheEntryKey != null)
                {
                    try {
                        OutputCache.RemoveFromProvider(dce.OutputCacheEntryKey, dce.ProviderName);
                    }
                    catch (Exception e) {
                        HandleErrorWithoutContext(e);
                    }
                }
            }
        }
All Usage Examples Of System.Web.Caching.OutputCache::RemoveFromProvider