Cache is used to save pages or data during HTTP requests. It allows you to store frequently accessed server resources in the memory. When a user sends the same request, the server does not process it again, but directly returns the data stored in the Cache to the user.
Cache:
Cache is used to save pages or data during http requests. It allows you to store frequently accessed server resources in the memory. When a user sends the same request, the server does not process it again, but directly returns the data stored in the cache to the user.
A cache instance is exclusive to each application, and its lifecycle is equal to the application cycle. After the application is restarted, its instance is re-created.
The key features of cache include: it is stored in the server memory and has nothing to do with the session. It may be discarded at any time according to the server memory resource status, and will not be serialized. Server-client data transmission will not occur.
<% @ Language = "vbscript" %>
<% Response. cachecontrol = "max-age = 300" %>
Note:
Max-age cache Time Parameter
300 cache 300 seconds
Take a look at asp tutorial. net
Page Cache
Use the outputcache command.
<% @ Outputcache duration = "3600"
Location = "any"
Varybycustom = "browser"
Varybyparam = "requestid" %>
The duration and varybyparam features are required.
Location controls the page cache location
Location meaning any
Default value. This means that the page output can be cached in the client browser, cached on any "downstream" client (such as a proxy server), or cached on the web server itself.
Client
Indicates that the output cache can only be stored in the local cache of the client that sends the request (that is, the browser ).
Downstream
Indicates that the output cache can be stored on any device (such as a proxy server) that supports the http1.1 cache.
Server
Indicates that the output cache will be stored on the web Server
None
Indicates that the output cache is disabled for this page.
Duration allows us to control the time for the page to survive in the cache (unit: seconds)
The asp.net tutorial provides you with a powerful and easy-to-use cache mechanism to store objects created from a large number of server resources in the memory. Caching these types of resources will greatly improve the application performance. It is stored in the server's memory, allowing you to customize how to cache items and how long they will be cached. For example, in the absence of system memory, the cache automatically removes rarely used or lower-priority items to release the memory. This technology, also known as cleanup, is one of the ways in which the cache ensures that expired data does not use valuable server resources. It is not related to sessions, so it is shared by multiple sessions. Therefore, it can improve website performance, but may leak user security information, because the cache may be automatically removed when the server lacks memory, you need to check whether the cache item exists each time you obtain data.