Merge pull request #2735 from xmcclure/early-lookup-addr
[mono.git] / mcs / class / System.Web / System.Web.Caching / OutputCacheModule.cs
index d1a6cd3486ce3bbe5688fb1ac711cee58d200d77..fd576c97747f80cf7dad5443d5aad5110bb4fe73 100644 (file)
@@ -45,23 +45,17 @@ namespace System.Web.Caching
 {      
        sealed class OutputCacheModule : IHttpModule
        {
-               OutputCacheProvider provider;
                CacheItemRemovedCallback response_removed;
                static object keysCacheLock = new object ();
                Dictionary <string, string> keysCache;
                Dictionary <string, string> entriesToInvalidate;
-#if !NET_4_0
-               internal OutputCacheProvider InternalProvider {
-                       get { return provider; }
-               }
-#endif
+               
                public OutputCacheModule ()
                {
                }
 
                OutputCacheProvider FindCacheProvider (HttpApplication app)
                {                               
-#if NET_4_0
                        HttpContext ctx = HttpContext.Current;
                        if (app == null) {
                                app = ctx != null ? ctx.ApplicationInstance : null;
@@ -73,26 +67,12 @@ namespace System.Web.Caching
                        string providerName = app.GetOutputCacheProviderName (ctx);
                        if (String.IsNullOrEmpty (providerName))
                                throw new ProviderException ("Invalid OutputCacheProvider name. Name must not be null or an empty string.");
-                       
-                       if (String.Compare (providerName, OutputCache.DEFAULT_PROVIDER_NAME, StringComparison.Ordinal) == 0) {
-                               if (provider == null)
-                                       provider = new InMemoryOutputCacheProvider ();
-                               return provider;
-                       }
-
-                       OutputCacheProviderCollection providers = OutputCache.Providers;
-                       OutputCacheProvider ret = providers != null ? providers [providerName] : null;
 
+                       OutputCacheProvider ret = OutputCache.GetProvider (providerName);
                        if (ret == null)
                                throw new ProviderException (String.Format ("OutputCacheProvider named '{0}' cannot be found.", providerName));
 
                        return ret;
-#else
-                       if (provider == null)
-                               provider = new InMemoryOutputCacheProvider ();
-                       
-                       return provider;
-#endif
                }
                
                public void Dispose ()