This is a migrated thread and some comments may be shown as answers.

Read() without cache

2 Answers 615 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Guru
Top achievements
Rank 2
Guru asked on 21 Jun 2012, 04:14 PM
I have a problem that when we datasource.read() it gets cached data and not up-to-date data from the server.
Of course it seems that it only does it in internet explorer... firefox works fine.

We send a query string with a random number to keep the request from getting cached data.
GridData = new kendo.data.DataSource({
     transport: {
            read: {
                url: buildAsyncUrl('GetData'),
                dataType: "json",
                data: JSON.stringify(GridFilters)
            }
        },
        ......
});

function buildAsyncUrl(cont) {
    return cont + '/?nocache=' + Math.random();
}

//whenever we need to refresh the grid we call:
 
GridData.read();


If you profile it it firefox:
1rst request:   ?nocache=0.36012812319771115
2nd request:   ?nocache=0.5465367197402407
3rd request:   ?nocache=0.5722005265817256

If you profile it in IE:
1rst request:   ?nocache=0.6602959470869887
2nd request:   ?nocache=0.6602959470869887
3rd request:   ?nocache=0.6602959470869887

How can I keep the datasource.read() from reusing the same value (url) it had when first called or initiated??
Or is there any "no cache" like option?

2 Answers, 1 is accepted

Sort by
0
Guru
Top achievements
Rank 2
answered on 21 Jun 2012, 04:49 PM
I have a solution for my case; Since we use asp.net mvc we added a nocache to our application controlloer class.

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public class AppController : Controller{}

I suppose this is more of an application/browser issue but still curious if kendo datasource has and caching options I am not finding...
0
Traci
Top achievements
Rank 1
answered on 19 Sep 2012, 07:12 PM
thanks a million for this...

I just had this same problem and happened to locate this particular thread which saved me a lot of time.

I added the same workaround that you did and everything worked fine for me as well (ie, we're using IE only).
Tags
Data Source
Asked by
Guru
Top achievements
Rank 2
Answers by
Guru
Top achievements
Rank 2
Traci
Top achievements
Rank 1
Share this question
or