class Add

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

Publish tag entries only when SET NX creates the value. A failed add must not shorten an existing entry's lifetime and make pruning hide a live value.

Methods

__construct(StoreContext $context, Serialization $serialization)

Create a new add operation instance.

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

Execute the add operation with tag tracking.

string
addWithTagsScript()

Register memberships only after creating the value.

Details

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

Create a new add operation instance.

Parameters

StoreContext $context
Serialization $serialization

at line 37
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; values below one are stored for one second

array $tagIds

Array of tag identifiers

Return Value

bool

True if the key was added; false if it already existed or a write failed

at line 109
protected string addWithTagsScript()

Register memberships only after creating the value.

Return Value

string