Skip to content

Use incremental Redis scans for cache maintenance - #406

Open
Apeksha9389 wants to merge 1 commit into
python-cachier:masterfrom
Apeksha9389:bugfix/incremental-redis-maintenance
Open

Apeksha9389 wants to merge 1 commit into
python-cachier:masterfrom
Apeksha9389:bugfix/incremental-redis-maintenance

Conversation

@Apeksha9389

Copy link
Copy Markdown

Redis maintenance currently issues KEYS, which scans the whole database in one blocking command. Traverse incremental SCAN pages instead for sync/async cache clearing, calculation-flag clearing, and stale-entry removal. Preserve prefix filtering and existing warning behavior, and process delete/pipeline work per returned page.

Fixes #405; addresses item 10 in #367.

Validation:

  • Redis test suite: 51 passed, 1 skipped (live Redis service unavailable; in-memory client tests ran).
  • Six new regressions fail on master and pass here. They cover all six methods, an empty intermediate scan page, a nonempty final page, and prohibit KEYS calls.
  • Additional integration checks with fakeredis and its async client: 350 entries per client, flag reset, stale deletion, full clear, and unrelated-key preservation passed. No new test dependency is required by this PR.
  • Repository Ruff and formatting checks passed; git diff --check passed.
  • Mypy has the same three pre-existing SQL backend errors as master with the installed dependencies; no new diagnostics.

Prepared with AI assistance; behavior and regressions were verified locally.

@Apeksha9389
Apeksha9389 requested a review from shaypal5 as a code owner October 17, 2026 13:29

This branch has not been deployed

No deployments
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.

Use incremental Redis scans for cache maintenance instead of blocking KEYS

1 participant