如何删除输出缓存儿童行动(MVC3) [英] How to remove output cache for child action (MVC3)

查看:139
本文介绍了如何删除输出缓存儿童行动(MVC3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试这个code

public ActionResult RemoveCache(Guid product_Id)  
{  
    var url = Url.Action("ProductPreview", "Common", new { product_Id = product_Id });  
    HttpResponse.RemoveOutputCacheItem(url);  
    return RedirectToAction("Index");  
}  

,以删除一个子动作的输出缓存,但它不工作。请帮帮我,谢谢!

to remove the output cache for a child action, but it does not work. Please help me, thanks!

推荐答案

在使用MVCDonutCaching的NuGet包: HTTP ://mvcdonutcaching.$c$cplex.com/

Use the MVCDonutCaching nuget package at: http://mvcdonutcaching.codeplex.com/

请参阅题为使用的部分:
http://www.devtrends.co .UK /博客/甜甜圈输出缓存功能于asp.net-MVC-3

See the section entitled "Usage" at: http://www.devtrends.co.uk/blog/donut-output-caching-in-asp.net-mvc-3

从缓存中删除项目。有一个参数Html.Action重载您添加到强制甜甜圈洞(从而排除缓存)

for removing items from the cache. There are Html.Action overloads with a param you add to force the donut hole (and thus exclude caching)

@Html.Action("Login", "Account", true)

真正的上述表示不缓存这个孩子的行动 - 创建一个甜甜圈洞

The true above means 'don't cache this child action - create a donut hole'

这篇关于如何删除输出缓存儿童行动(MVC3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆