asp.net page output cache

  • 2020-05-09 18:22:12
  • OfStack

It is mainly used for infrequent updates and modifications, and is heavily processed at the first compilation. The page output cache is the entire page that is cached
It's easy to use < %@ OutPutCache Duration="60" VaryByParam="none"% >
Duration: cache time
VaryByParam: update the contents of the cache with a parameter
There are other ones
CacheProfile: call the cache time in WebConfig
For example, in WebCofig
 
<system.web> 
<outputCacheSetting> 
<outputCacheProfiles> 
<add name="cacheTest" duration="50"/> 
<outputCacheProfiles> 
</outputCahceSetting> 
</system.web> 

Declare it on the page
< %@ OutputCache CacheProfile="cacheTest" VaryByParam="none"% >
VaryByControl: controls to change the cache
< %@OutputCache Duration="60" VaryByParam="none" VaryByControl="Button1"% >

Related articles: