class AddEntry

Adds a cache key reference to all tag sorted sets.

Each tag maintains a sorted set where:

  • Members are cache keys
  • Scores are TTL timestamps (or -1 for forever items)

This allows efficient tag-based cache invalidation and cleanup of expired entries via ZREMRANGEBYSCORE.

Methods

__construct(StoreContext $context)

No description

void
execute(string $key, int $ttl, array $tagIds, string|null $updateWhen = null)

Add a cache key entry to tag sorted sets.

Details

at line 24
__construct(StoreContext $context)

No description

Parameters

StoreContext $context

at line 41
void execute(string $key, int $ttl, array $tagIds, string|null $updateWhen = null)

Add a cache key entry to tag sorted sets.

Uses pipeline when multiple tags are provided for efficiency. In cluster mode, uses sequential commands since RedisCluster doesn't support pipeline mode and tags may be in different slots.

Parameters

string $key

The cache key (without prefix)

int $ttl

TTL in seconds (0 means forever, stored as -1 score)

array $tagIds

Array of tag identifiers (e.g., "_all:tag:users:entries")

string|null $updateWhen

Optional ZADD flag: 'NX' (only add new), 'XX' (only update existing), 'GT'/'LT'

Return Value

void