SELECT TOP * queries not cached ?

Oct 16, 2014 at 5:06 PM
Hello,

I added EF Cache in my webapp with basic settings and simple InMemoryCache, no changes whatsoever. It seems to work fine for almost all queries except the ones with Skip/Take linq limits, i.e. the ones which generate SELECT TOP x * FROM ... queries. Is this a hard limitation of the cache ?
Thanks.
Oct 18, 2014 at 7:47 AM
Is the X value the same or it is changing?
Oct 21, 2014 at 12:33 AM
X is changing, but the caching/not caching issue does not always happen, sometimes it works and sometimes it doesn't. I'll try to do more tests to give you a better idea of the problem.
Oct 27, 2014 at 4:18 AM
I tried the following scenario:
var skip = 1;
var take = 2;
using (var ctx = new MyContext())
{
    var q = ctx.Entities.OrderBy(e => e.Id).Skip(skip).Take(take);
    var entities = q.ToArray();
}

using (var ctx = new MyContext())
{
    var q = ctx.Entities.OrderBy(e => e.Id).Skip(skip).Take(take);
    var entities = q.ToArray();
}
and I can see that entities are being cached when queried the first time and returned from the cache where queried the second time. Please attach a repro for cases it does not work otherwise I won't be able to do anything about it.

Thanks,
Pawel