flutter_cache_manager icon indicating copy to clipboard operation
flutter_cache_manager copied to clipboard

Support to manually trigger CacheStore._cleanupCache()

Open deniza opened this issue 4 years ago • 1 comments

🚀 Feature Requests

Support to manually trigger CacheStore._cleanupCache()

Describe the feature

In current CacheStore implementation _cleanupCache() function is triggered 10 seconds later after every call to CacheStore.retrieveCacheData function. That means; if we don't request a new -not yet cached uri-, retrieveCacheData function will not be triggered, so there is no way that _cleanupCache logic have a chance to run again.

As I understand correctly; in current implementation there is no way to get a new version of an already cached url resource till we request a new uri resource to trigger cleanup logic.

Platforms affected (mark all that apply)

  • [x] :iphone: iOS
  • [x] :robot: Android

deniza avatar Dec 14 '20 15:12 deniza

As it turns out, cleaning up the cache does not help you to get a refreshed image if you use same URI. Calling CachedNetworkImage.evictFromCache does the trick but one should call this function for all the keys in cache to wipe all cached data. Maybe it's better not to use CachedNetworkImage if content is chancing while URI is not. Or using some additional dummy URL parameters to invalidate cached keys.

deniza avatar Dec 14 '20 17:12 deniza