• G
    Redis cache store: avoid blocking the server in `#delete_matched` · ef2af628
    Gleb Mazovetskiy 提交于
    Fixes #32610. Closes #32614.
    
    Lua scripts in redis are *blocking*, meaning that no other client can
    execute any commands while the script is running. See
    https://redis.io/commands/eval#atomicity-of-scripts.
    
    This results in the following exceptions once the number of keys is
    sufficiently large:
    
        BUSY Redis is busy running a script.
        You can only call SCRIPT KILL or SHUTDOWN NOSAVE.
    
    This commit replaces the lua-based implementation with one that uses
    `SCAN` and `DEL` in batches. This doesn't block the server.
    
    The primary limitation of `SCAN`, i.e. potential duplicate keys, is of
    no consequence here, because `DEL` ignores keys that do not exist.
    ef2af628
redis_cache_store.rb 15.3 KB