I. Static cache for all pages:
Add a line under <% @ page... %>:
<% @ Outputcache duration = "60" varybyparam = "NONE" %>
// The cache time is 60 seconds. Different pages are not cached based on parameters.
2. cache different pages based on parameters:
<% @ Outputcache duration = "60" varybyparam = "state" %>
// Cache different pages based on different state parameters. It is suitable for displaying different content on a page based on different parameters, but may be limited.
Iii. Hard disk cache technology
<% @ Outputcache duration = "3600" varybyparam = "NONE" diskcacheable = "true" %>
// Pages with a large data volume can be cached, but data cannot be changed frequently. Otherwise, the result is counterproductive.
Iv. Callback Cache
4.1 <% @ outputcache... %>
4.2 <asp: substitution id = "subsititution1" runat = "server" method = "getcurrentdate"/>
// The page is cached normally, but the content in subsitituion is not cached.
V. SQL caching (SQL connection pool technology)
When the data in the database (table) changes, the notification page is refreshed. Otherwise, it is taken directly from the cache.
Method:
5.1 entering MS-DOS Mode
5.2 run the aspnet_regsql.exe Parameter
Common parameters:
-S: the SQL Server to be registered
-E windows integrated authentication (replace parameter:-u-p, that is, the SQL user name and password)
-D database name
-Et allows registration of separate tables
-T table name
For example:
1) aspnet_regsql.exe-s "\ SQL Express"-e-d "pubs"-ed
2) aspnet_regsql.exe-s "\ SQL Express"-e-d "pubs"-et-T "author"
5.3 call
<% @ Outputcache duration = "999999" sqldependency = "pubs: Author" varybyparam = "NONE" %>
Note: Generally, one or two tables are monitored. Otherwise, the connection pool will become a system performance bottleneck.