When is the cached Page class updated and rebuilt?
When is the cached Page class upd开发者_运维问答ated and rebuilt?
A webpage is rebuilt (recompiled) whenever the application is restarted - with an explicit restart in IIS, on IISReset or when the web.config is updated.
But I think you mean "When does it get re-executed and new content delivered?". Is this what you mean? If so, it is when the cache expires on the page. This is set by the CacheDuration property in the OutputCache directive.
For example:
<%@ OutputCache Duration="120" VaryByParam="paramList" %>
This will make the page cache for 2 minutes, meaning that the same content is delivered every time the page is browsed for the next 2 minutes. After this, the cache will expire and the page will execute again, delivering up to date content. In this case, there is an extra VaryByParam attribute which means that multiple versions of the page will be cached for the given duration, one version for each variation of the parameters defined in paramList.
See this link: https://web.archive.org/web/20211020111708/https://www.4guysfromrolla.com/articles/121306-1.aspx
精彩评论