3

Looking at the MSDN doc for .NET 2.0 of the HttpContext.Cache object it says this:

The Cache for the current HTTP request.

But looking at the .NET 3.0 version version it says:

The Cache for the current application domain.

That's a pretty significant difference in functionality. My experience in using it has always been that it was a Per Request cache. But the docs appear to disagree with me. What is the correct usage? Are the MSDN docs wrong?

Micah
  • 111,873
  • 86
  • 233
  • 325
  • " My experience in using it has always been that it was a Per Request cache" = no, it's always been per-AppDomain. – Joe Aug 19 '11 at 16:44
  • I'm obviously confusing it with `HttpContext.Current.Items` which is a per request storage. – Micah Aug 19 '11 at 16:52

1 Answers1

2

The functionality hasn't changed, only the description.

"The Cache for the current HTTP request" is "The Cache for the current application domain", that is, the application domain in which the current request is executing.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • 1
    But then the behavior is supposedly different between 2.0 and 3.0. 2.0 provides a **per request** cache and 3.0 says it's an **app domain** cache. That's two completely different behaviors. – Micah Aug 19 '11 at 16:01
  • 2
    @Micah - Cache has always been per app domain. HttpContext.Cache always points to HttpRuntime.Cache which is static (=per app domain). Only the doc is better :-) – Simon Mourier Aug 19 '11 at 16:47