Add
class Add
Store an item in the cache if it doesn't exist, with tags support.
Uses Redis SET with NX flag for atomic "add if not exists" operation. Only adds tag entries if the cache key was successfully created.
Methods
Create a new add with tags operation instance.
Execute the add operation.
Get the Lua script for adding a value if it doesn't exist, with tag tracking.
Details
at line 22
__construct(StoreContext $context, Serialization $serialization)
Create a new add with tags operation instance.
at line 37
bool
execute(string $key, mixed $value, int|null $seconds, array $tags)
Execute the add operation.
at line 169
protected string
addWithTagsScript()
Get the Lua script for adding a value if it doesn't exist, with tag tracking.
KEYS[1] - The cache key (prefixed) KEYS[2] - The reverse index key (tracks which tags this key belongs to) ARGV[1] - Serialized value ARGV[2] - TTL in seconds, or zero for no expiration ARGV[3] - Tag prefix for building tag hash keys ARGV[4] - Tag registry key ARGV[5] - Current timestamp ARGV[6] - Raw key (without prefix, for hash field name) ARGV[7] - Tag hash suffix (":entries") ARGV[8...] - Tag names