JavaScript Editor Javascript validator     Javascripts

Main Page


Previous Section Next Section

18.1 Types of Caching

There are several different types of caching present in ASP.NET. Some are automatic and require no intervention on the part of the developer, while others require explicit coding.

18.1.1 Class Caching

When a web page or web service (.aspx or .asmx file, respectively) contains all its code inline, then that code is compiled into a page class the first time the page or service is run. This causes some delay, but that compiled class file is then cached on the server and is called directly every subsequent time the page (or service) is referenced. This is done automatically; there is no user or developer interaction required for this to happen.

The CLR watches for source code changes. If the source code changes, the CLR knows to recompile the next time the page or service is called.

If code-behind is used, the page or web service class is already pre-compiled, either manually by the developer or automatically by Visual Studio .NET.

18.1.2 Configuration Caching

Application-wide configuration information is contained in the configuration files. Chapter 20 discusses the specifics of configuration in detail. For now, the relevant point is that when the application is started (i.e., the first time a page or service is called from the application virtual root directory), all the configuration information must be loaded. This can take some time, especially if the configuration files are extensive. Configuration caching allows the application to store the configuration information in memory, thus saving time when the information is subsequently needed.

18.1.3 Output Caching

Output caching is the caching of pages or portions of pages that are output to the client. This is one of the main performance-enhancing techniques available to the developer. Since the page does not have to be recreated from scratch each time a request is made for it, the web site throughput, measured in requests per second, can be significantly increased.

Cached pages or portions of pages are stored in the web server's memory. Subsequent requests for the same page or portion of page are fulfilled directly from memory, rather than recreated by the page's program logic.

Output caching is discussed in the next section of this chapter.

18.1.4 Object Caching

Object caching is the caching of objects on the page, such as data bound controls. In contrast to output caching, object caching stores the cached data in server memory. Object caching will be covered in detail later in this chapter.

    Previous Section Next Section


    JavaScript Editor Javascript validator     Javascripts 




    ©