-
Notifications
You must be signed in to change notification settings - Fork 77
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
Cache Size #36
Comments
If you create a CacheableImage component
Then when you change the source on the same component, it will delete the original cached image, and replace it with the updated source. The component understands it's state. If you don't replace the CacheableImage source but instead create a new CacheableImage with the new source, a new image will be cached. The original Image will also be held in cache. if you load the app and restore the state from the last time the app closed, it would start the application with the last cached image. Then you can update the source on the CacheableImage and it will first remove the original image from the cache and replace it with the new source. |
I'm developing an app which uses a lot of images, our idea is to have them cached along with our state cache we're building, in #32 I mentioned a way to clear cache of specific images, I'd definitely use that in our project, but I want to be sure: If I forget to delete my cached images or something goes wrong whilst our cleaning method is running and some pictures don't get deleted: is there a way to setup a cache cleaning? will my cached pictures stay there forever? |
We can probably create an additional static method ClearAll() or something that will iterate over the directory that contains the cached files and remove them all. Maybe we can make the function smarter and pass a white-list of files to be kept and remove the others... thoughts? |
Sounds good to me. I think it could be smarter in these ways:
Both solutions would require to save the date of caching somewhere, which is a solution of other caching components (e.g. setting up a database, which I don't believe necessary to have). Since the cache clearing would be bounded to our models/state cache clearing, deleting cached images per source url and the whole folder would be enough. |
How to set up Cache Size? I'm working on a project which could have thousands of image so obviously i just want library to cache only the latest image and dynamically remove the older one with a fixed cache size. Is there any way, I could implement it?
The text was updated successfully, but these errors were encountered: