Laravel Version
12.31.1
PHP Version
8.4.7
Database Driver & Version
Redis 7.1 Serverless
Description
After the recent PR that atomically flushes Redis cache tags (#57098), calling flush() on a tagged cache using a Redis Cluster now throws the error:
RedisCluster::eval(): All keys do not map to the same slot
It appears that the atomic flush implementation is trying to run EVAL on multiple keys that are not in the same Redis slot. In Redis Cluster, all keys passed to an EVAL command must be in the same hash slot, or the command will fail with this error.
This makes it impossible to flush tagged cache in a Redis Cluster setup after the PR. I'm running my application on Laravel Vapor.
Steps To Reproduce
- Set up Laravel with a Redis Cluster and use Redis as the cache driver.
- Use tagged cache (
Cache::tags([...])->flush()).
- Observe that the error is thrown:
RedisCluster::eval(): All keys do not map to the same slot.
- This happens only after updating to a version 12.30 or higher