Using CacheCow with asp.net MVC kendoUI

168 views Asked by At

I've been looking into installing CacheCow ( https://github.com/aliostad/CacheCow ) , by just applying the nuget package and then adding:

GlobalConfiguration.Configuration.MessageHandlers.Add(new CacheCow.Server.CachingHandler(GlobalConfiguration.Configuration));

to my global config file. Once i do this though, none of my grids will refresh properly, they all cache old values regardless of new data being made available or not. I've used the header:

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]  
public JsonResult _GetProjectList([DataSourceRequest] DataSourceRequest request)
{
    return Json(data.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet);
}

for outputcache at the top, but that doesn't seem to help. Anyone have any experience using cachecow with kendo datasources, and how to get them to work with each other?

1

There are 1 answers

1
David Shorthose On

You could try this as a solution.

[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);
}

I had to do this a while ago when I noticed that some of the Kendo widgets weren't updating their datasources correctly. (they did update when I turned off browser caching within the dev tools of the browser).

Although I haven't worked with that particular package hopefully this will work for you.