Cache
Cache is used to save pages or data during an HTTP request. It allows frequently accessed server resources to be stored in memory, and when the user makes the same request, the server does not process it again but returns the data stored in the cache directly to the user.
The cache instance is proprietary to each application, and its lifecycle is equal to the application cycle. An application reboot will re-create its instance.
Cache key features are: stored in the server memory, the session is irrelevant, depending on the state of the server memory resources can be discarded at any time, not serialized, no server-client data transfer.
<% @language = "VBScript"%>
<% Response.CacheControl = "max-age=300"%>
Description
max-age Cache Time parameter
300 Cache 300 seconds
Take a look at the ASP tutorial. Net
Page Caching
Use the OutputCache directive.
<%@ OutputCache duration= "3600"
location= "any"
varybycustom= "Browser"
Varybyparam= "RequestID"%>
Where the duration and VaryByParam characteristics are required.
Location control the location of the page cache
Location meaning any
The default value. means that the output of the page can be slowed down by the client browser, any "downstream" clients (such as proxy servers), or cached in the Web server itself
Client
Indicates that the output cache can only be stored in the local cache of the requesting client (that is, the browser)
Downstream
Indicates that the output cache can be stored in any device that supports http1.1 caching, such as a proxy server
Server
Indicates that the output cache will be stored on the Web server
None
Indicates that the page disables output caching
Duration allows us to control how long a page is in the cache (in seconds)
The
asp.net tutorial provides you with a powerful, easy-to-use caching mechanism for storing objects that require a large number of server resources to be created in memory. Caching these types of resources can greatly improve the performance of your application. It is stored in the server's memory, allowing you to customize how items are cached and how long they are cached. For example, when system memory is scarce, caching automatically removes less-used or lower-priority items to free memory. This technology is also known as cleanup, which is one of the ways caching ensures that outdated data does not use valuable server resources. It is not session-related, so it is shared by multiple sessions, so using it can improve the performance of the Web site, but it may reveal the user's security information and may automatically remove the cache when the server lacks memory, so it is necessary to detect whether the cache entry still exists each time the data is fetched.