Пример #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);
                    }
                }
            }
        }
Пример #2
0
        private static void DependencyRemovedCallback(string key, object value, CacheItemRemovedReason reason)
        {
            DependencyCacheEntry entry = value as DependencyCacheEntry;

            if (entry.KernelCacheEntryKey != null)
            {
                if (HttpRuntime.UseIntegratedPipeline)
                {
                    UnsafeIISMethods.MgdFlushKernelCache(entry.KernelCacheEntryKey);
                }
                else
                {
                    System.Web.UnsafeNativeMethods.InvalidateKernelCache(entry.KernelCacheEntryKey);
                }
            }
            if ((reason == CacheItemRemovedReason.DependencyChanged) && (entry.OutputCacheEntryKey != null))
            {
                try
                {
                    RemoveFromProvider(entry.OutputCacheEntryKey, entry.ProviderName);
                }
                catch (Exception exception)
                {
                    HandleErrorWithoutContext(exception);
                }
            }
        }
Пример #3
0
        // only used by providers
        private static void DependencyRemovedCallbackForFragment(string key, object value, CacheItemRemovedReason reason)
        {
            Debug.Trace("OutputCache", "DependencyRemovedCallbackForFragment: reason=" + reason + ", key=" + key);

            if (reason == CacheItemRemovedReason.DependencyChanged)
            {
                DependencyCacheEntry dce = value as DependencyCacheEntry;
                if (dce.OutputCacheEntryKey != null)
                {
                    try {
                        OutputCache.RemoveFragment(dce.OutputCacheEntryKey, dce.ProviderName);
                    }
                    catch (Exception e) {
                        HandleErrorWithoutContext(e);
                    }
                }
            }
        }
Пример #4
0
 private static void DependencyRemovedCallbackForFragment(string key, object value, CacheItemRemovedReason reason)
 {
     if (reason == CacheItemRemovedReason.DependencyChanged)
     {
         DependencyCacheEntry entry = value as DependencyCacheEntry;
         if (entry.OutputCacheEntryKey != null)
         {
             try
             {
                 RemoveFragment(entry.OutputCacheEntryKey, entry.ProviderName);
             }
             catch (Exception exception)
             {
                 HandleErrorWithoutContext(exception);
             }
         }
     }
 }