Reputation: 27
I am getting huge amount of data which is frequently used and getting updated too on application start in MVC application. I would like to know,
Which is faster to access, HttpContext.Application or HttpContext.Cache. What should I prefer.
Where does HttpContext.Cache creates memory? in RAM or in Cache Memory of Server..?
Upvotes: 0
Views: 33
Reputation: 170
Conceptually speaking..
Application is intended for data that is set ONCE per application (not necessarily at startup, maybe at point of first requirement), this exists across all user sessions/logins.
Cache is intended for data that MAY change, but can be valid for a cached period, after the period of time it will need to be re-fetched anyway.
Since you mention that your application needs to hold on to data that is being updated, this does not sound like a use for the Application object.
Upvotes: 1