I start working onchanging all widgets that can be rebuild using jsonRest rather than Memory, like filteringSelect and Dgrid in my app.
After I fixed the filteringSelect, replaced the memory with jsonRest and tested that it works well, I tried to use store/cache with it.
the testing showed that caching is not happening, and when I searched the web, I got with someone's answer:
this issue tells that cache not working with filteringSelect, but I need to use request. on the other hand, "request" requests the data immediately so it's not an option.
Can you give the right answer: 1. Does cache work with jsonRest on filteringSelect? 2. Can I use dgrid with jsonRest and cache also?
thanks
While
JsonRest
can be used withCache
just fine (regardless of what widget consumes it), the important thing to consider (which that mailing list post points out) is thatdojo/store/Cache
does not cachequery
calls to the store, onlyget
calls, sincequery
calls can include any variety of range, filter, and sort parameters. So I don't think you'd get the effect out of usingCache
that you're expecting.If your service doesn't have a large number of records, another option would be to use dojo-smore's RequestMemory store, which is essentially a middle ground between
Memory
andJsonRest
- it requests the full data set once (though it does request it as soon as the store is created), but then stores the entire set in memory for allquery
andget
calls.