首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在asp.net MVC kendoUI中使用CacheCow

在asp.net MVC kendoUI中使用CacheCow
EN

Stack Overflow用户
提问于 2015-05-29 21:13:45
回答 1查看 160关注 0票数 0

我一直在考虑安装CacheCow ( https://github.com/aliostad/CacheCow ),只需应用nuget包,然后添加:

代码语言:javascript
复制
GlobalConfiguration.Configuration.MessageHandlers.Add(new CacheCow.Server.CachingHandler(GlobalConfiguration.Configuration));

添加到我的全局配置文件。一旦我这样做了,我的网格都不会正确刷新,无论新数据是否可用,它们都会缓存旧值。我已经使用了头部:

代码语言:javascript
复制
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]  
public JsonResult _GetProjectList([DataSourceRequest] DataSourceRequest request)
{
    return Json(data.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet);
}

用于顶部的outputcache,但这似乎没有帮助。有没有人有使用cachecow和kendo数据源的经验,以及如何让它们相互协作?

EN

回答 1

Stack Overflow用户

发布于 2015-05-29 22:46:31

您可以尝试将此作为一种解决方案。

代码语言:javascript
复制
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]  
public JsonResult _GetProjectList([DataSourceRequest] DataSourceRequest request)
{
    //force the response to not cache the results. 
    this.Response.Cache.SetCacheability(HttpCacheability.NoCache);


    //some code here......
    return Json(data.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet);
}

不久前,当我注意到一些Kendo小部件没有正确更新它们的数据源时,我不得不这么做。(当我在浏览器的开发工具中关闭浏览器缓存时,它们确实更新了)。

虽然我还没有使用过这个包,但希望它能为你工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30530584

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档