Skip to content

Remove use of KEYS command #307

@ipmb

Description

@ipmb

The keys command is used here to find a set of keys to delete

local keys = redis.call('keys', ARGV[1])

Redis docs have a strong warning about the keys command:

Warning: consider KEYS as a command that should only be used in production environments with extreme care. It may ruin performance when it is executed against large databases. This command is intended for debugging and special operations, such as changing your keyspace layout. Don't use KEYS in your regular application code. If you're looking for a way to find keys in a subset of your keyspace, consider using SCAN or sets.

scan looks like it would be a straightforward substitution.

Even when there aren't lots of this is a concern because it is listed in the @dangerous ACL command category which may be blocked on some installations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions