The new class MemoryCache in .Net 4.0 appears to act just like asp.net caching. My questions are:
Is MemoryCache equivalent to storing an object/value in for a user in Session Cache, but not in the code behind of an aspx page.
Can a value stored in MemoryCache, which exists on the server, be accessable to a web page event?
Is MemoryCache equivalent to storing an object/value in for a user in Session Cache
No, it is not equivalent. The ASP.NET Session object is per user key/value storage, whereas MemoryCache is an application level key/value storage (values are shared among all users).
Can a value stored in MemoryCache, which exists on the server, be accessable to a web page event?
In ASP.NET MVC there are usually no web page events but you can access values stored in MemoryCache everywhere within the application.
Basically, in an ASP.NET application, the new MemoryCache
object is just a wrapper for the old HttpContext.Cache
object (it stores values in the old Cache object).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With