Decrement
class Decrement
Decrement the value of an item in the cache with tags support.
Decrements the numeric value and adds/updates tag entries. If the key doesn't exist, creates it with negative of decrement value (no initial TTL).
Optimization: Uses Lua script to perform decrement, TTL check, and tag updates in a single network round trip (1 RTT).
Methods
Execute the decrement operation.
Get the Lua script for decrementing a value with tag tracking.
Details
at line 24
__construct(StoreContext $context)
Create a new decrement with tags operation instance.
at line 37
int|bool
execute(string $key, int $value, array $tags)
Execute the decrement operation.
at line 158
protected string
decrementWithTagsScript()
Get the Lua script for decrementing 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] - Decrement 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