如何缓存 mvc3 webgrid 结果(以便 col sort click 不会?
有人可以告诉我如何缓存我的网络网格结果,以便当我按列排序时,它不会每次都重新运行我的存储过程查询吗?
当单击列链接进行排序时,填充表/网格的存储过程(有点慢)每次都会重新执行并访问数据库。任何缓存提示和技巧将不胜感激。
谢谢!
Can somebody please tell me how I can cache my webgrid results so that when I sort by column it doesn't re-run my stored procedure query every time?
When clicking on a column link to sort, the stored proc (which is a little slow) that populates the table/grid is re-executed every time and hits the database. Any caching tips and tricks would be greatly appreciated.
Thx!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在调用存储库上应该查询数据库的方法的控制器操作内部,您可以检查缓存是否已包含结果。
这是一个常用的模式:
Well inside the controller action which is invoking the method on your repository supposed to query the database you could check whether the cache already contains the results.
Here's a commonly used pattern: