将用户控件输出缓存到内存以外的其他位置
我已经实现了一个基于磁盘的缓存,并且还希望使其能够输出缓存用户控件。我读过,我不能将基于磁盘的输出缓存提供程序用于用户控件,而只能用于输出缓存整个页面。
是否可以以其他方式将用户控件输出缓存到磁盘或其他存储类型(db)?
谢谢 托马斯
I have implemented a diskbased cache and would also like to enable it to outputcache usercontrols as well. I have read that I cannot use the diskbased outputcache provider for usercontrols but only to outputcache entire pages.
Is it possible to outputcache the usercontrol to disk in some other way or to some other storagetype (db) ?
thanks
Thomas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ASP.Net 4.0 添加了输出缓存可扩展性。您可以通过创建输出缓存提供程序来实现此目的。用 Scott Gu 的话说,
您可以通过子类化来创建输出缓存提供程序
OutputCacheProvider 基类。
创建缓存提供程序后,您可以在 web.config 文件中注册它:
当您将 OutputCache 指令放在用户控件的 ascx 页面上时:
您应该能够为您的用户控件使用此自定义缓存提供程序。
有关详细信息,请参阅 Scott Gu 的优秀博客文章。
ASP.Net 4.0 added output cache extensibility. You do this by creating an output cache provider. In the words of Scott Gu,
You create an output cache provider by subclassing the
OutputCacheProvider base class.
Once you have created the cache provider, you can register it in your web.config file:
When you put an OutputCache directive on your user control's ascx page:
you should be able to use this custom cache provider for your user control.
For more information, see Scott Gu's excellent blog post.