-
Notifications
You must be signed in to change notification settings - Fork 20
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
custom cache key #158
Comments
👋 Welcome to the community! |
@kevinranks, thanks for your suggestion. I'm summarising my understanding so that we can brainstorm it internally and come up with a solution. You expect an additional prop Have I understood it correctly? |
Yes exactly. In an app that users upload many images to a remote server, it makes sense to be able to utilize the local copy of that image prior to uploading it remotely. It's my understanding that right now the internal cache key is based off of the URL. By offering the ability to override that it gives developers a lot more control over the cache. For example, being able to reference a local path for an image and then later use the remote URL, and as long as the cacheKey is the same for both you can show the local (temp) image while the image is being uploaded remotely. Once the upload is complete the source URI can change to the remote URL, but if the cacheKey is the same, it would not need to download the image again. All without any additional components or special logic. Thanks for forking this package and maintaining it! |
@kevinranks, it definitely makes sense. We will brainstorm internally and come up with a solution. Also, if you're interested in contributing to this repo, would suggest you to join our discord channel - https://discord.gg/BNHhcpYD |
It would be awesome to have the ability to provide a custom
cacheKey
that would fall back to use the URI if none provided.Our use-case is that some of the images are already available locally, prior to being uploaded to a remote distribution endpoint.
With a custom
cacheKey
we could take advantage of the local images by setting something like likecacheKey: ${image.id}-${updatedAt}
with the local image path. Later if it uses the remote URL it would already have the image cached based on the customcacheKey
and not need to re-cache the same image.The text was updated successfully, but these errors were encountered: