It is my understanding that this.store.query and this.store.queryRecord will never be cached (they will always do a request), but the documentation does not state that (at least during my quick perusal).
We should update the documentation for all of the primary methods to indicate what will happen for repeated calls (do they return prior results, do they always trigger an XHR, etc):
store.query in https://github.com/emberjs/data/pull/4763store.queryRecord in https://github.com/emberjs/data/pull/4892store.findAll noopstore.findRecord noopstore.peekAll noopstore.peekRecord in https://github.com/emberjs/data/pull/4900This API documentation should probably also link to the corresponding shouldBackgroundReload type docs that explain how to tweak/modify the behavior.
Can I help with doing this? Maybe I could start with store.query and store.queryRecord?
@ryanlabouve please do! 馃檹
@rwjblue They are cached, they just never return from cache. Yes, we should document this :)
@runspired if they never return from cache then what's the reason for caching?
@GCheung55 because you might want to peekRecord or peekAll afterwards, and if the record is already in the store, you get it back :D
@GCheung55 so that belongsTo, hasMany, peekAll peekRecord and findRecord continue to work like they should :P
Starting with query, I'm wanting to double check my understand of what's happening. If this is right, I'll work on wording and PR:
The results of
queryare cached (source) in the store, however each time this method is called a new request is made (source).
Should I add something about why these are cached? (as @runspired / @locks ) points out above)?
We looked at peekAll and it seems like it answers the caching questions well.
@jonpitch is going to PR on peekRecord.
The documentation on findAll and findRecord seem to answer some of the questions in the original issue. There are sections about reloading, but they do not link to other docs.
Boxes checked off, closing this!
Most helpful comment
Can I help with doing this? Maybe I could start with
store.queryandstore.queryRecord?