flutter_cache_manager icon indicating copy to clipboard operation
flutter_cache_manager copied to clipboard

Clear cache filesystem when emptying the store cache

Open js2702 opened this issue 1 year ago • 1 comments

:sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Bug fix

:arrow_heading_down: What is the current behavior?

When there is a desync between the filesystem and the store those files are never cleaned up, filling up the filesystem. This desync can happen because of bugs in the library like the ones listed in #476.

:new: What is the new behavior (if this is a feature change)?

When calling emptyCache we can also clean up the cache directory associated to the store to clean up dangling files as well.

:boom: Does this PR introduce a breaking change?

It adds a method to the file system interface.

:bug: Recommendations for testing

Previously files were not deleted when calling removeFile(), so it only affects extra dangling files in the cache store. So to test it just add an extra file and call emptyCache.The current emptyCache test has been tweaked to account for this behavior.

:thinking: Checklist before submitting

  • [X] All projects build
  • [X] Follows style guide lines (code style guide)
  • [X] Relevant documentation was updated
  • [X] Rebased onto current develop

js2702 avatar Dec 09 '24 13:12 js2702

@renefloor could you review this ? Can you consider adding additional maintainers ?

cedvdb avatar Apr 22 '25 13:04 cedvdb