class Add

Store an item in the cache if it doesn't exist, with all tag tracking.

Combines the ZADD operations for tag tracking with the atomic add in a single connection checkout for efficiency.

Uses Redis SET with NX (only set if Not eXists) and EX (expiration) flags for atomic "add if not exists" semantics without requiring Lua scripts.

Note: Tag entries are always added, even if the key exists. This matches the original behavior where addEntry() is called before checking existence.

Methods

__construct(StoreContext $context, Serialization $serialization)

No description

bool
execute(string $key, mixed $value, int $seconds, array $tagIds)

Execute the add operation with tag tracking.

Details

at line 27
__construct(StoreContext $context, Serialization $serialization)

No description

Parameters

StoreContext $context
Serialization $serialization

at line 42
bool execute(string $key, mixed $value, int $seconds, array $tagIds)

Execute the add operation with tag tracking.

Parameters

string $key

The cache key (already namespaced by caller)

mixed $value

The value to store

int $seconds

TTL in seconds

array $tagIds

Array of tag identifiers

Return Value

bool

True if the key was added (didn't exist), false if it already existed