对于 .net 4 中的函数
我在 Scottgu 关于使用 OutputCache 实现功能的博客,但这对我不起作用。如何将 [OutputCache(Duration=60)] 用于函数?我可以在此语句中添加 VaryByParam 吗?需要哪个命名空间?
I read at Scottgu blog about using OutputCache for a function but this didn't worked for me. How can I use [OutputCache(Duration=60)] for a function and can I add VaryByParam in this statement? Which namespace is required?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OutputCacheAttribute 类是 < href="http://msdn.microsoft.com/en-us/library/system.web.mvc.aspx" rel="nofollow noreferrer">System.Web.MVC 命名空间。您可以将 VaryByParam 与它一起使用:
但我猜您只能将其应用于返回 ActionResult 的 MVC 方法 - 我认为您不能在 WebForms 项目中使用它(我是从你的问题猜测你正在使用什么)。
The OutputCacheAttribute class is part of the System.Web.MVC namespace. You can use VaryByParam with it:
but I would guess that you can only apply it to MVC methods that return an ActionResult - I don't think you could use it in a WebForms project (which I'm guessing from your question is what you're using).