Skip to content

Clear cache filesystem when emptying the store cache - #536

Open
rickdijk wants to merge 3 commits into
mainfrom
carry/477-empty-fs
Open

rickdijk wants to merge 3 commits into
mainfrom
carry/477-empty-fs

Conversation

@rickdijk

Copy link
Copy Markdown
Contributor

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

Bug fix. This carries #477 by @js2702, whose branch does not allow maintainer edits, so it could not be updated in place. Both of their commits are kept, with main merged on top.

⤵️ What is the current behavior?

emptyCache() only deletes the files the cache store knows about. Files on disk that are missing from the store, for example after a desync like the ones in #476, are never cleaned up and keep filling the cache directory.

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

emptyCache() deletes the whole cache directory through a new FileSystem.deleteCacheDir(), then removes all objects from the store. IOFileSystem, MemoryCacheSystem and the test FileSystem implement it, and MemoryCacheSystem recreates its temp directory on next use.

💥 Does this PR introduce a breaking change?

Yes. FileSystem gets a new abstract method, deleteCacheDir(), so apps that implement their own FileSystem must add it.

🐛 Recommendations for testing

Format, analyze and tests pass locally on Flutter 3.47.2; CI on 3.47.4 is the check that counts. The existing emptyCache test now also writes a file that is not in the store and checks that every file is gone.

📝 Links to relevant issues/docs

Supersedes #477. Related: #476.

🤔 Checklist before submitting

  • All projects build
  • Follows style guide lines (code style guide)
  • Relevant documentation was updated
  • Rebased onto current main
  • Version bumped and dated CHANGELOG entry added

Co-authored-by: Jorge Sardina jorge@skilldevs.com

🤖 Generated with Claude Code

js2702 and others added 3 commits December 9, 2024 13:01
cache_store_test.dart conflicted only with main's format pass
(cce9a65). Took main's formatting and re-applied this branch's change.

Co-Authored-By: Claude <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

2 participants