Files
outline/server/utils
Tom MoorandClaude Fable 5 db1d93f9b5 perf: Use SCAN and batched UNLINK instead of KEYS in CacheHelper.clearData (#12934)
* perf: Use SCAN and batched UNLINK instead of KEYS in CacheHelper.clearData

The KEYS command blocks the Redis event loop while it walks the entire
keyspace, which stalls all other clients on large installations —
notably on startup where the whole unfurl cache prefix is cleared.
Replace it with incremental SCAN iteration and delete the matched keys
in batches with UNLINK, which reclaims memory asynchronously, so
neither discovery nor deletion blocks the server. Adds test coverage
for CacheHelper including multi-page prefix clears.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015K9AAwaGTLVQZnp7uv5Ebj

* fix: Address review comments on CacheHelper.clearData

Unlink each SCAN batch as the scan progresses instead of buffering all
matching keys in memory, repeating until a full pass matches nothing so
implementations with unstable scan cursors still clear every key. Wrap
the operation in try/catch with logging for consistency with the other
CacheHelper methods, and mark constants as readonly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015K9AAwaGTLVQZnp7uv5Ebj

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-08 04:42:02 -04:00
..
2026-01-10 12:28:00 -05:00
2026-06-29 17:11:02 -04:00