Cache Management for Network Applications
This topic and its related subtopics describe caching for resources obtained using the WebClient, WebRequest, HttpWebRequest, and FtpWebRequest classes.
A cache provides temporary storage of resources that have been requested by an application. If an application requests the same resource more than once, the resource can be returned from the cache, avoiding the overhead of re-requesting it from the server. Caching can improve application performance by reducing the time required to get a requested resource. Caching can also decrease network traffic by reducing the number of trips to the server. While caching improves performance, it increases the risk that the resource returned to the application is stale, meaning that it is not identical to the resource that would have been sent by the server if caching were not in use.
Caching may allow unauthorized users or processes to read sensitive data. An authenticated response that is cached may be retrieved from the cache without an additional authorization. If caching is enabled, change to CachePolicy to BypassCache or NoCacheNoStore to disable caching for this request.
Due to security concerns, caching is not recommended for middle tier scenarios.
In This Section
- Cache Policy
Explains what a cache policy is and how to define one.
- Location-Based Cache Policies
Defines each type of location-based cache policy available for Hypertext Transfer Protocol (http and https) resources.
- Time-Based Cache Policies
Describes the criteria that can be used to customize a time-based cache policy.
- Configuring Caching in Network Applications
Describes how to programmatically create cache policies and requests that use caching.
Reference
- System.Net.Cache
Defines the types and enumerations used to define cache policies for resources obtained using the WebRequest, HttpWebRequest, and FtpWebRequest classes.