ASP.NET provides a convenient way to control the cache. The @OutputCache directive can be used to control the page output cache
- Resource files such as css, js, image, and aspx can be read locally on the second visit without having to request the server side again, reducing the pressure on the client to request resources from the server and speeding up the client's response speed.
- For frequently used data sources, store them in the data cache or in memory to reduce database requests and relieve database pressure.
- Deploying websites on multiple computers and processing them in a distributed manner can effectively solve the pressure caused by multiple user requests on one server and speed up the response of client requests (distributed deployment).
- Pages that will be frequently accessed but whose data is not updated can be treated statically, effectively reducing server pressure and client response speed.
Disable caching
My asp.net page OutputCache is configured as follows:
We need to disable the cache in the project development, otherwise, the page will not take effect after modification, in the past I have commented out this feature, in fact, there is a better solution,
Add the following configuration to the system.web node of web.config:
In the Web.Release.config file, configure it as follows:
In release mode, configuration items that disable caching are removed, which does not affect development or release.
Flush the cache
If we modify the data in the database, the page cannot be refreshed immediately, which greatly affects the user experience, in order not to affect the user experience, we can delete the cache and let the page reload, which is equivalent to refreshing the cache.
For example:
Testing perfection can flush the cache without affecting the cache of other pages.
Resources:The hyperlink login is visible.
|