{
sealed class OutputCacheModule : IHttpModule
{
- OutputCacheProvider provider;
CacheItemRemovedCallback response_removed;
static object keysCacheLock = new object ();
Dictionary <string, string> keysCache;
Dictionary <string, string> entriesToInvalidate;
-
+
public OutputCacheModule ()
{
}
OutputCacheProvider FindCacheProvider (HttpApplication app)
{
-#if NET_4_0
HttpContext ctx = HttpContext.Current;
if (app == null) {
app = ctx != null ? ctx.ApplicationInstance : null;
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 ()