General Q's: How does a cache work with the server in ASP.NET?

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.

Up vote 1 down vote favorite 1 share g+ share fb share tw.

I'm trying to learn about caching in asp.net and am having difficulty understanding the following questions from this article (msdn.microsoft.com/en-us/library/18c1wd6...): 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 caching link|improve this question asked Apr 1 '11 at 1:28cfarm542,5131144 82% accept rate.

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: It becomes stale according to the expiration time explicitly set by the caller One of the resources the cached data depends on is altered Or the server simply requires more memory (and the data has a relatively low caching priority compared to other cached data).

Nathan Thanks. So just to be sure, this means if I'm trying to generate a wiki-like page (that refreshes it's data every other day), this method could work? – cfarm54 Apr 1 '11 at 2:28 1 I would probably use output caching for this scenario.

Data caching allows you to store and retrieve arbitrary objects in your code, whereas output caching caches the final HTML which is sent to the user. This makes it extremely efficient as it bypasses the whole ASP . NET page model and simply serves the page to the user.

It's appropriate when you have public pages which should be the same for every user (especially if they consist of static content). – Nathan Pitman Apr 1 '11 at 2:48 This page has some dynamic content though. I heard that if it has dynamic content then it's better to use data caching.

What do you think? This is the problem that I'm actually trying to solve and wondering if caching is a better alternative stackoverflow.com/questions/5505993/… – cfarm54 Apr 1 '11 at 3:09 1 Oh ok, so you're wanting to cache the data that you get from the third party provider but you're not too concerned about caching other content? In that case, it might be easier to simply use data caching.

If you're wanting to cache both the third party data and other static content in the page, that could make things more complicated and you might have to look into other fragment/custom caching schemes. – Nathan Pitman Apr 1 '11 at 3:30 So you think that data caching might work for storing the 3rd party data right? – cfarm54 Apr 1 '11 at 4:00.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions