During one of discussion about caching, one senior developer pointed out that the HttpContext.Current.Cache is NOT shared among different user sessions.

I felt very shocked because I thought HttpContext.Current.Cache is shared among different user sessions. I quickly did research over internet, and confirmed that HttpContext.Current.Cache is shared among different user sessions.

MSDN – HttpContext.Cache: “There is one instance of the Cache class per application domain. As a result, the Cache object that is returned by the Cache property is the Cache object for all requests in the application domain.”

 

References:

HttpContext.Cache

StackOverflow – Is the HttpContext.Current.Cache available to all sessions

https://forums.asp.net/t/1410077.aspx?HttpContext+Current+Cache+shares+data+between+browsers

https://forums.asp.net/t/1792625.aspx?HttpContext+Current+Cache

Advertisements