django / channels_redis

Redis channel layer backend for Django Channels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove use of KEYS command

ipmb opened this issue · comments

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.

Sounds right. 👍