mardi 18 septembre 2018

Caching dynamically-generated images in front-end

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:

  1. the front-end sends a request for generating a chart image to a back-end endpoint
  2. this image is then passed to the front-end in the endpoint's response, as a base64 encoded image
  3. the front-end displays this image
  4. now, the user can select a new entity, etc.

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?




Aucun commentaire:

Enregistrer un commentaire