ASP.Net 中的页面缓存问题
我们在 ASP.Net 网站主页中使用页面输出缓存,以使其加载速度更快。 缓存时间非常短(5分钟),以便将数据更新反映给用户 短时间内。在主页本身中,我们有一个名为“投票”的部分,用于为所显示的问题投票最佳答案。 在此部分中,当用户已经投票时显示投票结果,对于尚未投票的用户,则显示投票结果, 必须显示民意调查问题。问题是,当已经投票的用户访问主页时, 页面被缓存并显示投票结果。在这 5 分钟的缓存时间内,当另一个用户 尚未投票已访问该页面,然后对于该用户,结果也仅显示 民意调查问题,因此用户无法对该民意调查进行投票。
为了防止这种情况,我们尝试了数据缓存技术,其中所有部分的数据表 主页被缓存并呈现页面。这种技术仍然不如页面输出缓存那么快,因此我们的用户不希望这样 技术。与页面输出缓存相比,两种数据缓存的加载时间要长得多。
我们还尝试了替代缓存方法,即使整个页面都被重新加载,部分页面也会被重新加载。 它缓存的页面。这种缓存方法中最重要的问题是我们在该替换中只能使用 HTML 控件 控制。我们尝试仅使用 HTML 控件创建民意调查部分,但在使用 AJAX 更新面板时仍然遇到问题 在页面的其他部分。
请指导我解决这个问题。必须为每个用户和其他部分单独重新加载页面的一部分(民意调查部分) 必须从缓存中传递。这应该在不影响页面性能的情况下发生。
We use page output caching in our ASP.Net website home page to make it appear load faster.
The caching time is very minimum(5 minutes) so that the data updations are reflected to users
within short time span. In the home page itself, We have a section called 'Polls' used for voting best answer for the question displayed.
In this section, poll results are displayed when a user has already voted and for users who haven't voted,
the poll question has to be displayed. The issue is, when a user who has already voted has visited the home page, the
page is cached with poll results displayed. Within that 5 min's caching time, when another user who
has not yet voted has accessed that page then for that user also results are only displayed instead
of poll question so the user is not able to vote for that poll.
To prevent this, we have tried out data caching technique where datatable for all sections in
home page is cached and the page is rendered. This technique still is not as fast as Page output caching and so our users does not desire this
technique. The loading time for both data caching is much higher when compared to page output caching.
We have also tried out substitution caching method where a part of the page alone gets reloaded even when the entire
page it cached. The most important issue in this caching method is we can use only HTML controls in that substitution
control. We have tried creating polls section with HTML controls only, still we get problems with AJAX update panel used
in other sections of the page.
Kindly guide me to resolve this issue. A part of the page(polls section) alone has to be reloaded for each user and other sections
has to be delivered from cache. This should happen without compromising performance of the page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经在 iframe 中实现了页面的轮询部分,iframe 内的内容不会被缓存。简单的临时解决方案!
I have implemented polls section of the page in an iframe, the content inside the iframe does not get cached. Simple, temporary solution!!!
谷歌搜索“甜甜圈缓存”或查看这些:
http://weblogs.asp.net/scottgu/archive/2006/11/28/tip-trick-implement -donut-caching-with-the-asp-net-2-0-output-cache-substitution-feature.aspx
关闭用户控件中的页面级缓存
google for "Donut caching" or look at these :
http://weblogs.asp.net/scottgu/archive/2006/11/28/tip-trick-implement-donut-caching-with-the-asp-net-2-0-output-cache-substitution-feature.aspx
Turn off page-level caching in a user control