I am trying to implement a web application with Caching features.The reason I need caching is for is that we have an application which lets users access online courses. Now, Once the user logs in I validate him against our database. Once validated I want to store the user ID and course ID in cache for 20 mins so that if he requests it again I can retrieve values from cache foe both user id and course ID and if valid provide him access For some reasons I can't use Session variables in this application so they are not an option.
Now, the caching code in my application is inside a HTTP Handler(.ashx file). Now I tried calling the cache object like you do for a aspx page but I could not, probably because it's a handler and not a webpage. So,
Cache.Insert("Id", 123);
will not work in Handler. So then I tried HTTPRuntime.cache. But after doing some research I found out the HTTPRuntime.cache is common to the whole application. I don't completely understand "Whole application". Does it mean that it is shared by all the users on different computers accessing our applications? or does it mean it's shared by all the users on one computer accessing our application. Because if it is the latter I am OK with it. So is HTTPRuntime.cache a good way to cache data for one browser(or one computer) or is there a different and better way to implement Browser caching to store data?
Cache is stored in web server memory.
You should understand the differences between Viewstate, Cache and Session
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