Cache types and application caches

Sorry if the question is dumb.

I read somewhere that

ASP.NET supports three types of caching:

Page Output Caching [Output Caching]

Fragment Caching [Output Caching]

data caching

and somewhere

There are two types of caching in ASP.NET:

* Application caching
* Page output caching


How many cache types does ASP.NET support?


source to share

1 answer

The differences are summarized pretty well here:

Learning Caching in ASP.Net

You have listed the same types of caching multiple times; I would suggest reading the link above and if you have any further difficulties, come back and ask more specific questions.

To summarize the article:

  • We can use Page Output Caching for those pages whose content is relatively static. So instead of generating a page for each user request, we can cache the page by caching the page output so that it can be accessed from the cache itself. Pages can be generated once and then cached for subsequent fetches. Page output caching allows you to cache all the content of a given page.

  • Page fragments caching . ASP.NET provides a mechanism for caching portions of pages called page fragment caching. To cache a portion of a page, you must first encapsulate the portion of the page that you want to cache into a custom control. In your original user control file, add the OutputCache directive specifying the Duration and VaryByParam attributes. When this custom control is loaded onto a page at runtime, it is cached and all subsequent pages that reference the same user control will retrieve it from the cache

  • Data caching . Data caching can significantly improve application performance by reducing contention and round trips. Simply caching the data stores the required data in the cache so that the web server will not send requests to the DB server every time for every request, which increases the performance of the website. I will also add that you can also store user data in this cache if you are aware of the restrictions (for example, the time the data is available, for example), as well as data from many other data stores.

It could also be argued that there are several other types of caching supported by ASP.Net; for example, you can use State Bags, or simply view the ViewState to cache data between roundtrip client trips. Application and Session objects can also be used to cache data (again with limitations), but this is really also the purview of data caching.

In short, there are tons of places you can dump data in ASP.Net - it's more about which one to use and when!



All Articles