Increment
class Increment
Increment the value of an item in the cache with tags support.
Increments the numeric value and adds/updates tag entries. If the key doesn't exist, creates it with the increment value (no initial TTL).
Optimization: Uses Lua script to perform increment, TTL check, and tag updates in a single network round trip (1 RTT).
Methods
Execute the increment operation.
Get the Lua script for incrementing a value with tag tracking.
Details
at line 24
__construct(StoreContext $context)
Create a new increment with tags operation instance.
at line 37
int|bool
execute(string $key, int $value, array $tags)
Execute the increment operation.
at line 158
protected string
incrementWithTagsScript()
Get the Lua script for incrementing a value with tag tracking.
KEYS[1] - The cache key (prefixed) KEYS[2] - The reverse index key (tracks which tags this key belongs to) ARGV[1] - Increment amount ARGV[2] - Tag prefix for building tag hash keys ARGV[3] - Tag registry key ARGV[4] - Current timestamp ARGV[5] - Raw key (without prefix, for hash field name) ARGV[6] - Tag hash suffix (":entries") ARGV[7...] - Tag names