1

我想显示一个未缓存的页面,但仍然利用 outputcache。假设管理员希望通过在 url 中添加查询字符串 nocache=1 来查看实时更新的页面,那么 outputcache 不会显示缓存的版本,但如果不使用查询字符串,它会显示。我可以这样做吗?

4

2 回答 2

1

最好的选择可能是实现一个自定义缓存提供程序,当给定一组参数时,它不会缓存页面。这是一个这样的例子:

http://www.haneycodes.net/custom-output-caching-with-mvc3-and-net-4-0-done-right/

于 2013-04-24T05:37:41.493 回答
0

If you create some miscellaneous parameter and configure the output caching to varyByParam, you should be able to call it with different values each time, it should bypass the cache... However I'm not sure this would be the best way to do that. You may want to just create a separate action for the admin to access that is secured.

于 2013-04-24T04:51:44.037 回答