Reputation: 2041
I am currently working with the following situation: I have an Ember front-end with N entities, and the user can view dynamically-generated chart images for each of these entities. For this purpose, when the user wants to view the chart for on an entity, the following happens:
At the moment, the user has to wait for a chart image to be loaded 3-5 seconds, no matter whether this entity's chart has been viewed before. This is quite annoying: wait to view chart for entity A, then wait to view chart for entity B, then wait again if you want to see entity A again, etc.
I want to cache somehow the already viewed images in the front-end, in order to avoid this waiting time. (The content of the images does not change frequently, perhaps once a day or so, so this is not a problem).
Can this be done with Ember, or am I looking at this from a wrong point of view and an entirely different strategy is required?
Upvotes: 0
Views: 146
Reputation: 2827
Use .peekRecord()
first and check if it has any result. If it's on the ember store, it will show to you. You can visualize if you are caching correctly on Ember inspector.
Upvotes: 1