mirror of
https://github.com/outline/outline.git
synced 2026-11-21 05:24:03 +03:00
* 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>