是否可以在服务器端缓存ASP页面? [英] Is it possible to cache an asp page on the server side?

查看:79
本文介绍了是否可以在服务器端缓存ASP页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



如果是这样,它怎么知道是否已更改?

解决方案

是的,这里是页面缓存,它将缓存页面60秒:





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


VaryByCustom



任何文本代表自定义输出缓存要求。如果为该属性赋予浏览器值,则缓存会因浏览器名称和主要版本信息而异。如果输入了自定义字符串,则必须在应用程序的Global.asax文件中覆盖HttpApplication.GetVaryByCustomString
方法。



Let's assume you have a big complex index page, that shows news articles and stuff. It's not going to change very often. Can you cache it somehow on the serverside, so requests don't force to server to dynamically generate the entire page every time someone visits it? Or does ASP.NET do this automatically?

If so, how does it know if something has changed?

解决方案

Yes you can, here is the declarative version of page caching, which will cache the page for 60 seconds:

You ask about changes, notice the VaryByParam part - you can, for example, ensure that there is one cached page for each parameter. You can even implement your own custom variation with VaryByCuston, which can be really powerful:

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页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆