void OnBuildManagerRemoveEntry (BuildManagerRemoveEntryEventArgs args)
		{
			string entry = args.EntryName;
			HttpContext context = args.Context;
			string cacheValue;
			
			lock (keysCacheLock) {
				if (!keysCache.TryGetValue (entry, out cacheValue))
					return;
				
				keysCache.Remove (entry);
				if (context == null) {
					if (entriesToInvalidate == null) {
						entriesToInvalidate = new Dictionary <string, string> (StringComparer.Ordinal);
						entriesToInvalidate.Add (entry, cacheValue);
						return;
					} else if (!entriesToInvalidate.ContainsKey (entry)) {
						entriesToInvalidate.Add (entry, cacheValue);
						return;
					}
				}
			}

			context.Cache.Remove (entry);
			if (!String.IsNullOrEmpty (cacheValue))
				context.InternalCache.Remove (cacheValue);
		}
Ejemplo n.º 2
0
		void OnBuildManagerRemoveEntry (BuildManagerRemoveEntryEventArgs args)
		{
			string entry = args.EntryName;
			HttpContext context = args.Context;
			string cacheValue;

			lock (keysCacheLock) {
				if (!keysCache.TryGetValue (entry, out cacheValue))
					return;

				keysCache.Remove (entry);
				if (context == null) {
					if (entriesToInvalidate == null) {
						entriesToInvalidate = new Dictionary <string, string> (StringComparer.Ordinal);
						entriesToInvalidate.Add (entry, cacheValue);
						return;
					} else if (!entriesToInvalidate.ContainsKey (entry)) {
						entriesToInvalidate.Add (entry, cacheValue);
						return;
					}
				}
			}

			OutputCacheProvider provider = FindCacheProvider (context != null ? context.ApplicationInstance : null);
			provider.Remove (entry);
			if (!String.IsNullOrEmpty (cacheValue))
				provider.Remove (cacheValue);
		}