控件的 ASP.NET 缓存和输出缓存

发布于 2024-09-30 03:08:08 字数 203 浏览 1 评论 0原文

您知道我有办法通过数据缓存来缓存从 SQL Server 获取的数据。另外我可以输出缓存网络用户控件。

Web 用户控件包含来自 SQL 数据库的数据怎么样?缓存数据并缓存控件是否有意义?

这两个组件组合的最佳解决方案是什么?

是的。这是一个新手问题。

You know I have the way to Cache the data I've got from the SQL Server over data caching. In addition I can output cache web user controls.

Whats about a web user control contains data from a SQL database? Does it make sense to cache the data and also cache the control?

What is the best solution for the combination of these two components?

Yes. this is a newbie question.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哎呦我呸! 2024-10-07 03:08:08

如果缓存控件,则不需要缓存底层数据。
一如既往,最佳缓存取决于您的应用程序。

以下是一些一般准则:

对于复杂的 CPU/内存密集型查询以及在不同页面/控件上经常使用的数据,使用数据缓存。

对经常出现的控件使用输出缓存。与数据缓存相比,输出缓存往往更容易实现,需要更多地考虑线程/锁定等。

If you cache the control, then you don't need to cache the underlying data.
Optimal caching, as always, depends on your application.

Here are some general guidelines:

Use data caching for complex, CPU/Memory intensive queries, for data that is used very often on different pages/controls.

Use output caching for controls that appear often. Output caching also tends to be simpler to implement compared to data caching with requires more thought concerning threading/locking, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文