class TagKeyBuilder

Builds Redis-internal tag storage key names.

Keeping key formats here centralizes Redis implementation details while allowing the TagMode enum to remain purely semantic.

Methods

__construct(TagMode $mode, string $prefix)

Create a new tag key builder instance.

static string
tagSegmentFor(TagMode $mode)

Mode-only tag segment, for callers that don't have a prefix to hand (e.g. console tools that concatenate a cachePrefix externally).

string
tagSegment()

Tag segment prefix: "_any:tag:" or "_all:tag:".

string
tagId(string $tagName)

Tag identifier (without cache prefix): "_any:tag:{tagName}:entries".

string
tagKey(string $tagName)

Full tag key with cache prefix: "{prefix}_any:tag:{tagName}:entries".

string
reverseIndexKey(string $cacheKey)

Full reverse index key: "{prefix}{cacheKey}:_any:tags".

string
registryKey()

Full registry key: "{prefix}_any:tag:registry".

Details

at line 20
__construct(TagMode $mode, string $prefix)

Create a new tag key builder instance.

Parameters

TagMode $mode
string $prefix

at line 30
static string tagSegmentFor(TagMode $mode)

Mode-only tag segment, for callers that don't have a prefix to hand (e.g. console tools that concatenate a cachePrefix externally).

Parameters

TagMode $mode

Return Value

string

at line 38
string tagSegment()

Tag segment prefix: "_any:tag:" or "_all:tag:".

Return Value

string

at line 46
string tagId(string $tagName)

Tag identifier (without cache prefix): "_any:tag:{tagName}:entries".

Parameters

string $tagName

Return Value

string

at line 54
string tagKey(string $tagName)

Full tag key with cache prefix: "{prefix}_any:tag:{tagName}:entries".

Parameters

string $tagName

Return Value

string

at line 64
string reverseIndexKey(string $cacheKey)

Full reverse index key: "{prefix}{cacheKey}:_any:tags".

Any mode uses this to track which tags a cache key belongs to.

Parameters

string $cacheKey

Return Value

string

at line 74
string registryKey()

Full registry key: "{prefix}_any:tag:registry".

Any mode uses this as a sorted set of all active tags.

Return Value

string