![]() Response.Write("This page was generated and cache at:" + Protected void Page_Load(object sender, EventArgs e) The following event handler for page load would help in testing that the page was really cached. This tells the environment to cache the page for 15 seconds. Put this directive under the page directive. It enables output caching and provides certain control over its behaviour. The OutputCache directive is responsible of output caching. Output caching allows bypassing the round trips to server by caching data in memory. Rendering a page may involve some complex processes such as, database access, rendering complex controls etc. In this tutorial, we will consider output caching, data caching, and object caching. Configuration caching stores the configuration information in the server memory. When the source code is changed, the CLR recompiles the assembly.Ĭonfiguration Caching : Application wide configuration information is stored in a configuration file. Next time when a request is made for the page or service, the cached assembly is referred to. Then the assembly is cached in the server. ![]() The cached data is stored in server memory.Ĭlass Caching : Web pages or web services are compiled into a page class in the assembly, when run for the first time. Object Caching : Object caching is caching the objects on a page, such as data-bound controls. When the cache is expired, fresh data is obtained by the data source and the cache is refilled. As long as the cache is not expired, a request for the data will be fulfilled from the cache. When the next client requests for this page, instead of regenerating the page, a cached copy of the page is sent, thus saving time.ĭata Caching : Data caching means caching data from a data source. Output Caching : Output cache stores a copy of the finally rendered HTML pages or part of pages sent to the client. Caching in ASP.NetĪSP.NET provides the following different types of caching: You can access items in the cache using an indexer and may control the lifetime of objects in the cache and set up links between the cached objects and their physical sources. If caching does not take place for some reason.If the application releases its memory,.The data will not be available in the following cases: However, the storing information in state objects is deterministic, i.e., you can count on the data being stored there, and caching of data is nondeterministic. In some respect, caching is similar to storing the state objects. ![]() This resides with the application and is available via the HttpContext and .Page. The ASP.NET runtime includes a key-value map of CLR objects called cache. It is especially important for data related transactions, as these are expensive in terms of response time.Ĭaching places frequently used data in quickly accessed media such as the random access memory of the computer. Caching is a technique of storing frequently used data/information in memory, so that, when the same data/information is needed next time, it could be directly retrieved from the memory instead of being generated by the application.Ĭaching is extremely important for performance boosting in ASP.NET, as the pages and controls are dynamically generated here.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |