Skip to content
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

Clear image cache at startup #55

Open
ramsestom opened this issue Jun 15, 2017 · 0 comments
Open

Clear image cache at startup #55

ramsestom opened this issue Jun 15, 2017 · 0 comments

Comments

@ramsestom
Copy link

correct me if I am wrong but the ImageCache is limited to the application runtime. However, downloaded files persist in the device filesystem even if you close the app. To prevent deprecated cache files to take disk space uselessly, you should call the "clear()" function in your ImageCache constructor (as there is only one instance of ImageCache per app anyway). I think CacheDir returned by react-native-fetch-blob is specific to each app. Else you would also need to include the appID into your BASE_DIR construcor so that cleaning the cache in one app do not clean it for every running app using react-native-img-cache.
Also, having a counter that autoincrement rather than generating random file names (with calls to your s4 function ) for mutable images would be more simple and prevent any unluky ovewrite (aditionnaly, it could be used to clean oldest cache files only based on their name if necessary).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant