Web Farm 中的 ASP.NET 页面缓存
我们有一个小型网络场(2 个服务器),由 Windows 2003 中内置的网络负载平衡器进行平衡。我们有一些页面使用页面缓存。我的问题是:给定用户是否可能导致页面被缓存而另一个用户看到该内容?以下是相关页面的页面指令:
<%@ OutputCache Duration="1" NoStore="true" VaryByParam="none" %>
持续时间设置为“1”的原因是为了确保页面缓存时间不会超过 1 秒,因为页面上的操作可能会触发事务。
We have a small web farm(2 servers) balanced by the built in network load balancer in Windows 2003. We have a few pages that use page caching. My question is: Is it possible that that a given user could cause a page to be cached and another user see that content? Here is the page directive for the page in question:
<%@ OutputCache Duration="1" NoStore="true" VaryByParam="none" %>
The reason the duration is set to "1" is to ensure that the page isn't cached any longer than 1 second because of transactions that actions on the page can trigger.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您不应该将页面缓存一秒钟,而应该研究如何在事务执行后不运行事务。
I think instead of caching the page for one second you should look into how to not run transactions when they have been executed.
是的,所有在特定时刻请求页面的用户都将看到相同的输出。
在asp.net中,最好在控件级别使用OutputCache,它具有相同的语法。
您可以使用 VaryByCustom 并根据用户登录或其他信息进行设置。我为显示位置相关信息的页面实现了此功能。
另外,基于用户登录名/ID来实现它是没有意义的,因为用户不会每秒请求几次数据
Yes, all users who requested page in particular second will see SAME output.
In asp.net it is better to use OutputCache on controls level, which has same syntax.
You may go with VaryByCustom and make it based on user login or other info. i implemented this for page which was showing location dependendent info.
Also, There is no sense to implement it based on user login/id, because users will not request data few times a second