I’m trying to learn about caching in asp.net and am having difficulty understanding the following questions from this article (http://msdn.microsoft.com/en-us/library/18c1wd61%28v=vs.71%29.aspx):
- When adding items to the cache, I understand that you can specify a time limit for how long the data will persist. However, does this data persist only for this user or, if another user visits the same page simultaneously, will this data persist for that user as well?
- If the data is added to a cache, where exactly does it reside? Is it on the server or a user’s browser? If it’s on the server, how does the framework decide when it needs to release the resources?
ASP .NET offers a few forms of caching and the form demonstrated on that page is (arbitrary) data caching (using the Cache object). So to answer your questions:
1.) Data cached using this method is available to all users (in a threadsafe manner). But if you need to store user-specific data, use session state instead.
2.) Data is cached server side and is released when any of the following occur: