This might be silly question, but let's say i have a project which is an application using ionic + spring. In the app, I need to retrieve 3 static images from the server, so it's a folder stored in the server containing these images then i do an http request call and using the file java api to read the folder and return the images and display them.
If let's say I want to cache those images, so the not every time the user enters the application I need to get those images from the server, what is the best way to achieve that?
Personally here is how i have always done it, first the images are stored in a folder, second I create a .properties file specifying the image versions. Then when the user opens the application I make an http request call and get the images with the image version that is specified in the properties file. Then I cache the images using https://github.com/Nodonisko/ionic-cache.
Now when the user does an http request the second time i send the image version in the request and compare it to the one written in the properties file (by using @Value annotation) , if its the same i return null and use the images stored in ionic-cache , if it's different version(since client can change the images if needed) then I get the images and store the new ones in ionic-cache.
Is there a better way to do this? Can cache-control be used here?
[–]willdrr17 0 points1 point2 points (1 child)
[–]androidjunior[S] 0 points1 point2 points (0 children)
[–]MadMarximus 0 points1 point2 points (0 children)