gpt4 book ai didi

asp.net - 是否可以在服务器端缓存一个 asp 页面?

转载 作者:行者123 更新时间:2023-12-04 04:29:48 24 4
gpt4 key购买 nike

假设您有一个大型复杂的索引页面,其中显示新闻文章和内容。它不会经常改变。你能以某种方式在服务器端缓存它,这样每次有人访问它时,请求就不会强制服务器动态生成整个页面吗?还是 ASP.NET 会自动执行此操作?

如果是这样,它如何知道是否发生了变化?

最佳答案

是的,你可以,这是 page caching 的声明版本,这会将页面缓存 60 秒:

您询问更改,请注意 VaryByParam 部分 - 例如,您可以确保每个参数都有一个缓存页面。您甚至可以使用 VaryByCuston 实现您自己的自定义变体,这真的很强大:

VaryByCustom

Any text that represents custom output caching requirements. If this attribute is given a value of browser, the cache is varied by browser name and major version information. If a custom string is entered, you must override the HttpApplication.GetVaryByCustomString method in your application's Global.asax file.

关于asp.net - 是否可以在服务器端缓存一个 asp 页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2867415/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com