-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image caching improvements #129
base: master
Are you sure you want to change the base?
Image caching improvements #129
Conversation
Add an option to use a cache key that is different from the image URI. This is useful for example if the image URI contains a parameter that changes, but the image doesn't vary as a result, such as an authentication token. If the cache key is not present, the image URI will be used as the cache key.
Create a single promise to handle the downloading of a cache entry. Otherwise, multiple calls to get the path of a new cache entry will result in multiple downloads, until one of the downloads is successful. If the download is unsuccesful, unset the promise so that the next request will result in a new attempt to download the image.
+1 to this. |
@wcandillon any chance of getting this merged soon? |
Hey man you are AMAZING! |
@davidminor Thks for that, can you look into the merge conflicts? |
Before merging this it needs some work though, there is an edge case where if you delete a cached image then change the component's key the promise is never deleted it wont redownload/load the image, i resolved this by adding a check if the path has been resolved before
|
Just curious if this feature or something similar made its way into the library. I see there's been no activity for 6 months. |
We've been using a custom build and it fell off my radar. Probably won't have time to pick it back up for awhile. |
Got it, I implemented caching of the signed s3 urls on the server side. I have it set to cache for 5 days whereas the urls are good for 7 days. The mobile app itself reloads data from the server everytime it loads a page so I don't think there is a chance for the url to get stale. Anyways, thanks for your response. |
Hi guys, we are using a patched version of the library to use the feature. Is there any chance that this could make its way in the mainline code anytime soon? @davidminor |
Some improvements that I suggested in #126 & #127 -
The first commit adds an optional cache key property to
Image
to use instead of theuri
as the cache key.The second commit avoids repeat downloads if multiple
Image
components reference the sameuri
.