DoctorContext
final class DoctorContext
Context object holding shared state for Doctor checks.
Bundles all dependencies needed by functional checks to avoid passing many parameters to each check's run() method.
Constants
| private TEST_PREFIX |
Unique prefix to prevent collision with production data. Mode-agnostic - just identifies doctor test data. |
Methods
Create a new doctor context instance.
Get a value prefixed with the unique doctor test prefix.
Get the full Redis key for a tag hash/ZSET.
Compute the namespaced key for a tagged cache item in all mode.
Get the test prefix constant for cleanup operations.
Check if the store is configured for 'any' tag mode.
Check if the store is configured for 'all' tag mode.
Get the current tag mode.
Get the current tag mode as a string value.
Get patterns to match all tag storage structures with a given tag name prefix.
Get patterns to match all cache value keys with a given key prefix.
Details
at line 32
__construct(Repository $cache, RedisStore $store, RedisConnection $redis, string $cachePrefix, string $storeName)
Create a new doctor context instance.
at line 45
string
prefixed(string $value)
Get a value prefixed with the unique doctor test prefix.
Used for both cache keys and tag names to ensure complete isolation from production data.
at line 55
string
tagHashKey(string $tag)
Get the full Redis key for a tag hash/ZSET.
Format: "{cachePrefix}_any:tag:{tagName}:entries" or "{cachePrefix}_all:tag:{tagName}:entries"
at line 70
string
namespacedKey(array $tags, string $key)
Compute the namespaced key for a tagged cache item in all mode.
In all mode, cache keys are prefixed with xxh128 of tag IDs in the requested order. Format: "{xxh128}:{key}"
at line 84
string
getTestPrefix()
Get the test prefix constant for cleanup operations.
at line 93
bool
isAnyMode()
Check if the store is configured for 'any' tag mode.
In this mode, flushing ANY matching tag removes the item.
at line 102
bool
isAllMode()
Check if the store is configured for 'all' tag mode.
In this mode, items must match ALL specified tags.
at line 110
TagMode
getTagMode()
Get the current tag mode.
at line 118
string
getTagModeValue()
Get the current tag mode as a string value.
at line 135
array
getTagStoragePatterns(string $tagNamePrefix)
Get patterns to match all tag storage structures with a given tag name prefix.
Used for cleanup operations to delete dynamically-created test tags. Returns patterns for BOTH tag modes to ensure complete cleanup regardless of current mode (e.g., if config changed between runs):
- Any mode: {cachePrefix}_any:tag:{tagNamePrefix}*
- All mode: {cachePrefix}_all:tag:{tagNamePrefix}*
at line 157
array
getCacheValuePatterns(string $keyPrefix)
Get patterns to match all cache value keys with a given key prefix.
Used for cleanup operations to delete test cache values. Returns patterns for BOTH tag modes to ensure complete cleanup regardless of current mode (e.g., if config changed between runs):
- Untagged keys: {cachePrefix}{keyPrefix}* (same in both modes)
- Tagged keys in all mode: {cachePrefix}{xxh128}:{keyPrefix}* (namespaced)