RequiresHashFieldExpiration
trait RequiresHashFieldExpiration
Skips tests when the environment doesn't support Redis hash field expiration.
Hash field expiration requires:
- phpredis >= 6.3.0 (HSETEX command)
- Redis >= 8.0.0 or Valkey >= 9.0.0 (HEXPIRE command)
Expects InteractsWithRedis on the same class — uses redisClient() to probe the server version. The support check is memoized per process.
Constants
| private PHPREDIS_MIN_VERSION |
Minimum phpredis version required for hash field expiration. |
| private REDIS_MIN_VERSION |
Minimum Redis version required for hash field expiration. |
| private VALKEY_MIN_VERSION |
Minimum Valkey version required for hash field expiration. |
Methods
Skip the current test if hash field expiration requirements are not met.
Detect the installed phpredis version. Overridable for tests.
Detect the Redis/Valkey server info. Overridable for tests.
Flush the memoized hash field expiration support check.
Details
at line 51
protected void
skipIfHashFieldExpirationUnsupported()
Skip the current test if hash field expiration requirements are not met.
The check runs once per process and is then cached for all subsequent calls.
at line 100
protected string
detectedPhpredisVersion()
Detect the installed phpredis version. Overridable for tests.
at line 110
protected array
detectedServerInfo()
Detect the Redis/Valkey server info. Overridable for tests.
at line 120
static void
flushHashFieldExpirationState()
Flush the memoized hash field expiration support check.
Tests only. Resets the capability result shared by tests in this class.