Add --no-cache flag and document persistent blocklist cache#408
Closed
Add --no-cache flag and document persistent blocklist cache#408
Conversation
|
Merging to
|
Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement persistent disk cache for blocklist data
Add --no-cache flag and document persistent blocklist cache
Feb 20, 2026
|
This pull request was automatically closed because it expired on 2026-02-20T20:57:37.606Z.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every sync cold-starts by re-downloading all blocklists; the persistent disk cache already existed in the codebase but lacked a way to bypass it and had no user documentation.
Changes
main.py_no_cache: bool = Falsemodule-level flag--no-cacheCLI argument toparse_args()main(): sets_no_cache = True, clears the just-loaded disk cache, and consolidatedglobaldeclarationssave_disk_cache()returns early when_no_cacheis set_disk_cache[url] = ...write paths in_gh_get()guarded byif not _no_cache:tests/test_disk_cache.py_no_cache = Falseresets tosetUp/tearDownto prevent cross-test pollutiontest_no_cache_skips_disk_cache_write— verifies_disk_cacheis not populated during a fetchtest_no_cache_skips_save— verifies no cache file is written to diskREADME.md--clear-cache/--no-cacheflagsOriginal prompt
This section details on the original issue you should resolve
<issue_title>[Code Quality] Implement persistent disk cache for blocklist data</issue_title>
<issue_description>### Description
Currently, every sync operation performs a cold start - downloading and validating all blocklists from scratch. This results in unnecessary network I/O and longer sync times, especially for users running frequent syncs. Implementing a persistent disk cache with smart invalidation would reduce sync time by 30-50% on subsequent runs.
Problem
From Performance Research (Discussion #219):
Impact:
Suggested Changes
Implement persistent disk cache:
~/.cache/ctrld-sync/or/tmp/ctrld-sync-cache/Smart cache invalidation:
ETagheader if availableLast-Modifiedheader if available--no-cacheflagCache structure (example):
Implementation approach:
main.py--clear-cacheCLI optionFiles Affected
main.py(add cache logic or create separate cache module)cache.py(optional - if extracted to separate module)README.md(document cache location and CLI flags)Success Criteria
--no-cacheand--clear-cacheCLI optionsPriority
Medium - Significant performance improvement for user experience
Estimated Effort
1-2 days
Source
Extracted from Daily Perf Improver discussion abhimehro/ctrld-sync#219
Performance Research Findings:
Implementation Priority (from #219):
Comments on the Issue (you are @copilot in this section)
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.