After a long time ive checked the ember data documentation again. It looks better every time I check it out, but I always get new questions and problems.
So, records are cached. Thats clear. I also guess that the result of the
all() is cached. But are the results of querys cached? And if not, why not?
The primary reqson for me why I need query caching is the history. If I have a slow query and then the User is moving between detail and the list, I dont wanna make the server roundtrip every time.
But this would absolutly require to reset parts of the cache. Obviously the query caches, but it would be also good to have a way to mark the loaded model data in the cache as kind of inverted dirty. So that there are new data on the server, but without making the request until required.
Has anyone worked with similar problems, and is anything and the list of future Ember-Data improvements?
A near problem are server side procedures. It would be nice to have a generic way to call server side procedures on a model or a type. Its close to caching because a server side procedure could dirty some client side data!
A common example is the submit of a webshop basket. It would be called on a BasketItem Type, and then if succeeded delete all BasketItem Models, but could also create a new Record for the
LastOrders. So it would have to reset the all, and all query caches of that Type, but dont load them immediatly because we may dont need them.
Another example could be the registration to some kind of event. It could be just called on a Event Model instance, without any affect to the data of the application. But it also may would change a counter on that specific Event.
How do u currently handle use-cases like this?
Do u think a generic way to do this would be possible and desirable?
Has may someone already build something?