class StoreContext

Mode-aware context for Redis cache operations.

Constants

MAX_EXPIRY

The maximum expiry timestamp (Year 9999) for "forever" items.

Used in the tag registry to represent items with no expiration.

TAG_FIELD_VALUE

The value stored in tag hash fields.

We only need to track membership, so we use a minimal placeholder value.

Methods

__construct(Factory $redis, string $connectionName, string $prefix, TagMode $tagMode)

No description

string
prefix()

Get the cache key prefix.

string
connectionName()

Get the connection name.

TagMode
tagMode()

Get the tag mode.

string
tagId(string $tag)

Get the tag identifier (without cache prefix).

string
tagHashKey(string $tag)

Get the full tag hash key for a given tag.

string
tagHashSuffix()

Get the tag hash suffix (for Lua scripts that build keys dynamically).

string
tagScanPattern()

Get the SCAN pattern for finding all tag sorted sets.

string
reverseIndexKey(string $key)

Get the full reverse index key for a cache key.

string
registryKey()

Get the tag registry key (without OPT_PREFIX).

mixed
withConnection(callable $callback)

Execute callback with a held connection from the pool.

bool
isCluster()

Check if the connection is a Redis Cluster.

string
optPrefix()

Get the OPT_PREFIX value from the Redis client.

string
fullTagPrefix()

Get the full tag prefix including OPT_PREFIX (for Lua scripts).

string
fullReverseIndexKey(string $key)

Get the full reverse index key including OPT_PREFIX (for Lua scripts).

string
fullRegistryKey()

Get the full registry key including OPT_PREFIX (for Lua scripts).

Details

at line 31
__construct(Factory $redis, string $connectionName, string $prefix, TagMode $tagMode)

No description

Parameters

Factory $redis
string $connectionName
string $prefix
TagMode $tagMode

at line 43
string prefix()

Get the cache key prefix.

Return Value

string

at line 51
string connectionName()

Get the connection name.

Return Value

string

at line 59
TagMode tagMode()

Get the tag mode.

Return Value

TagMode

at line 70
string tagId(string $tag)

Get the tag identifier (without cache prefix).

Used by all mode for namespace computation (xxh128 of tag IDs in requested order). Format: "_any:tag:{tagName}:entries" or "_all:tag:{tagName}:entries"

Parameters

string $tag

Return Value

string

at line 80
string tagHashKey(string $tag)

Get the full tag hash key for a given tag.

Format: "{prefix}_any:tag:{tagName}:entries" or "{prefix}_all:tag:{tagName}:entries"

Parameters

string $tag

Return Value

string

at line 88
string tagHashSuffix()

Get the tag hash suffix (for Lua scripts that build keys dynamically).

Return Value

string

at line 98
string tagScanPattern()

Get the SCAN pattern for finding all tag sorted sets.

Format: "{prefix}_any:tag::entries" or "{prefix}_all:tag::entries"

Return Value

string

at line 108
string reverseIndexKey(string $key)

Get the full reverse index key for a cache key.

Format: "{prefix}{cacheKey}:_any:tags" or "{prefix}{cacheKey}:_all:tags"

Parameters

string $key

Return Value

string

at line 118
string registryKey()

Get the tag registry key (without OPT_PREFIX).

Format: "{prefix}_any:tag:registry" or "{prefix}_all:tag:registry"

Return Value

string

at line 134
mixed withConnection(callable $callback)

Execute callback with a held connection from the pool.

Delegates to Redis::withConnection() for context awareness (respects active pipeline/multi connections). Uses transform: false to provide raw phpredis behavior for cache operations.

Parameters

callable $callback

Return Value

mixed

at line 144
bool isCluster()

Check if the connection is a Redis Cluster.

Return Value

bool

at line 154
string optPrefix()

Get the OPT_PREFIX value from the Redis client.

Return Value

string

at line 166
string fullTagPrefix()

Get the full tag prefix including OPT_PREFIX (for Lua scripts).

Format: "{optPrefix}{prefix}_any:tag:" or "{optPrefix}{prefix}_all:tag:"

Return Value

string

at line 174
string fullReverseIndexKey(string $key)

Get the full reverse index key including OPT_PREFIX (for Lua scripts).

Parameters

string $key

Return Value

string

at line 182
string fullRegistryKey()

Get the full registry key including OPT_PREFIX (for Lua scripts).

Return Value

string