PutMany
class PutMany
Store multiple items in the cache (non-tagged).
Optimizes Laravel's default putMany() by using a Lua script in standard mode, reducing the number of commands Redis needs to parse.
Performance:
- Standard mode: Single Lua script execution with evalSha caching
- Cluster mode: Uses MULTI/EXEC for transactional grouping per-node, but commands are sent sequentially (RedisCluster does not support pipelining)
Methods
__construct(StoreContext $context, Serialization $serialization)
Create a new put many operation instance.
bool
execute(array $values, int $seconds)
Execute the putMany operation.
string
setMultipleKeysScript()
Get the Lua script for setting multiple keys with the same TTL.
Details
at line 27
__construct(StoreContext $context, Serialization $serialization)
Create a new put many operation instance.
at line 40
bool
execute(array $values, int $seconds)
Execute the putMany operation.
at line 149
protected string
setMultipleKeysScript()
Get the Lua script for setting multiple keys with the same TTL.
KEYS[1..N] - The cache keys to set ARGV[1] - TTL in seconds ARGV[2..N+1] - Serialized values (matching order of KEYS)