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.
Feature description
The current invalidateAll implementation uses the redis KEYS command to find the list of keys to invalidate.
The official redis documentation on KEYS (https://redis.io/docs/latest/commands/keys/) specifically recommends not using it in production due to its blocking nature.
In addition, AWS Serverless Elasticache specifically disables the KEYS command (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/SupportedCommands.html), most likely due to the above performance concerns. This results in the invalidateAll commands failing in a Serverless Elasticache cluster.
The Redis documentation recommends using a SCAN instead to find all of the keys.