Reputation: 5758
I have an app where I display network images. I cache the images. I also cache the profile picture of the user his/her friends. But there is a possibility a user updates his profile picture.
I'm thinking of a system that removes the profile pictures of the friends every 2 days.
All the profile pictures have this url:
https://firebasestorage.googleapis.com/v0/b/myPROJECT.appspot.com/o/profilepicturesFolder%USERID
I'm using the package flutter cache manager.
Is there a possibility to delete all cached images this url:
https://firebasestorage.googleapis.com/v0/b/myPROJECT.appspot.com/o/profilepicturesFolder
I'm currently using this:
await DefaultCacheManager().emptyCache();
(but it removes all images of the whole app out of the cache)
Thanks in advance!
Upvotes: 2
Views: 3247
Reputation: 2104
I suppose you are using this library: https://github.com/Baseflow/flutter_cache_manager You can provide expiration time for each image(in your case 48 hours). After that, file will be removed and trigger update from your back end.
Also seems your library chose not supported to set expiration time easyly, check https://github.com/Baseflow/flutter_cache_manager/pull/107 You need to provide special header for your images to ensure that cache will work only for 2 days
Upvotes: 1