Increase Web site performance with ASP.NET caching
ASP.NET 1.x provides three ways to incorporate caching in a Web application:
- Page Output caching: allows you to cache the dynamically generated page content.
- Page Fragment caching: caches portions of a Web page.
- Page Data caching: programmatically caches data/objects within a Web page.
Page Output caching
Output caching is applicable when the contents of an entire page are relatively static so it may be cached. Caching frequently accessed pages can result in substantial throughput gains. The way it works is initial page requests are generated dynamically with all subsequent requests served from the cache. The result is an enormous performance gain with heavily used applications.
The main aspect of caching a page is the expiration date. It determines how long content will be retained in the cache before it is reloaded from the source. It is accessible via code or with the page-level OutputCache directive. It includes the Duration parameter for specifying how long an item will be cached (in seconds). Along with Duration, the OutputCache directive contains the following attributes:
- Location
: The location of the cache. Valid values include Any, Client, Downstream, None, Server, and ServerAndClient. The default value is Any. - CacheProfile
: The name of the cache settings to associate with the page. It is an optional element with no default value. - NoStore
: A Boolean value signaling whether to prevent secondary storage of sensitive data. - Shared
: A Boolean value that determines whether user control output can be shared with multiple pages. - VaryByCustom
: Any text that represents custom output caching requirements. - VaryByHeader
: A semicolon-separated list of HTTP headers used to vary the output cache. - VaryByParam
: A semicolon-separated list of strings used to vary the output cache.
These parameters correspond to querystring values sent with HTTP GET requests or form parameters sent along with HTTP POST requests. When this attribute is set to multiple parameters, the output cache contains a different version of the requested document for each combination of specified parameters. Possible values include none, an asterisk (*), and any valid query string or POST parameter name.
Tags: ASP.NET, web development, caching, performance, web application, caching support, page caching, HTTP, GET, POST, varbyvalue, varbyparam, varbyheader, shared, duration
Can't find what you're looking for? Try Google Search!
Comments on "Increase Web site performance with ASP.NET caching"