Where does HttpRuntime.Cache store data?

I am trying to implement a web application with caching features. The reason I need caching is because we have an application that allows users to access online courses. Now, as soon as the user logs in, I will check him against our database. After checking, I want to keep the user ID and the course ID in the cache for 20 minutes, so that if he requests it again, I can get the values ​​from the cache of both the user ID and the course ID, and if the valid one grants him access For some reason I cannot use session variables in this application, so they are not an option.

Now the caching code in my application is inside the HTTP handler (.ashx file). Now I tried to call the cache object, as you did for the aspx page, but I could not, possibly because it is a handler, not a web page. In this way,

Cache.Insert("Id", 123); 

will not work in the handler. So, I tried HTTPRuntime.cache. But after some research, it turned out that HTTPRuntime.cache is common to the entire application. I do not quite understand the "whole application." Does this mean that all users on different computers get access to our applications? or it means that it will be used by all users on one computer to access our application. Because if this is the last, I am fine with him. So is HTTPRuntime.cache a good way to cache data for one browser (or one computer) or is there another and better way to implement browser caching for data storage?

+4
source share
1 answer

The cache is stored in the web server memory.

You Must Understand The Differences Between Viewstate, Cache And Session

+4
source

All Articles