Ember-Data .find() vs .all() - how to control cache?

后端 未结 2 525
走了就别回头了
走了就别回头了 2021-02-02 12:10

I was told that in order to not make a request all the time, one can use .all() method to load data that is kept in the store. But how does Ember deal with cache? I have a coupl

2条回答
  •  青春惊慌失措
    2021-02-02 12:46

    What you call cache is the content of the store. There are usually 2 ways to update the store to reflect changes made on the backend side:

    • the change happens with a user interaction/call to the server. If you update mulitple records on the backend side, you can sideload them with the response of that request.
    • the change happens asynchronously on the backend side (background job). You can use a websocket to push those changes to the client.

提交回复
热议问题