StoreContext
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
No description
Get the cache key prefix.
Get the connection name.
Get the tag mode.
Get the tag identifier (without cache prefix).
Get the full tag hash key for a given tag.
Get the tag hash suffix (for Lua scripts that build keys dynamically).
Get the SCAN pattern for finding all tag sorted sets.
Get the full reverse index key for a cache key.
Get the tag registry key (without OPT_PREFIX).
Execute callback with a held connection from the pool.
Check if the connection is a Redis Cluster.
Get the OPT_PREFIX value from the Redis client.
Get the full tag prefix including OPT_PREFIX (for Lua scripts).
Get the full reverse index key including OPT_PREFIX (for Lua scripts).
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
at line 43
string
prefix()
Get the cache key prefix.
at line 51
string
connectionName()
Get the connection name.
at line 59
TagMode
tagMode()
Get the tag mode.
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"
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"
at line 88
string
tagHashSuffix()
Get the tag hash suffix (for Lua scripts that build keys dynamically).
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"
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"
at line 118
string
registryKey()
Get the tag registry key (without OPT_PREFIX).
Format: "{prefix}_any:tag:registry" or "{prefix}_all:tag:registry"
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.
at line 144
bool
isCluster()
Check if the connection is a Redis Cluster.
at line 154
string
optPrefix()
Get the OPT_PREFIX value from the Redis client.
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:"
at line 174
string
fullReverseIndexKey(string $key)
Get the full reverse index key including OPT_PREFIX (for Lua scripts).
at line 182
string
fullRegistryKey()
Get the full registry key including OPT_PREFIX (for Lua scripts).