How to cache url data passed in the image widget? Mobile app.
Application Type
Mobile

I am passing a URL to fetch image from AMazon S3 in a mobile app.

Is there a way to cache all these images(coming from the url) for a certain amount of time?

Hello, @Amol Rane To cache your images you can use a client variable, to hold your image for a certain amount of time.

Also, if you have more problems, if you didn't see them until now you can look for other forums' comments here:

https://www.outsystems.com/forums/discussion/68538/external-image-isnt-caching/

https://www.outsystems.com/forums/discussion/59653/image-using-external-url-not-loaded-in-mobile-application/

Also the course about client variables and how to use them:

https://www.outsystems.com/training/lesson/2037/client-variables

Hope this helps!

Cheers,

Márcio Carvalho

Hi @Amol Rane 

To cache an image on mobile I will suggest creating a local entity where you can store the image, and each time you logout or the app times out the entity will be cleaned.

Regards

Gonçalo Almeida

I am currently using local storage, but the problem is that there are multiple images(something like Netflix), and all images are not getting fetched at once. Multiple server calls have to be made to the server to get one image(From s3), hence takes a lot of time to load. I tried doing this asynchronously using BPT, but we can't access the local storage actions in BPT.

So I realized Caching would be the way to go, where I can directly cache the data fetched from image urls. 

Please do let me know if there's another way I can approach this problem.

Hello Amol,

I agree with @Goncalo Almeida, local storage is indeed the way to go. Here's a link to a similar question and the recommendation - How to cache images in mobile app | OutSystems 

If needed you may check out the section on how to build a light weight local storage here - OutSystems Mobile Best Practices - OutSystems

Best regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.