Back
What you can do is try to get the instance (\Redis::instance()) and work with it like this:
try{ $redis = \Redis::instance(); // Do something with Redis.}catch(\RedisException $e){ // Fall back to other db usage.}
try
{
$redis = \Redis::instance();
// Do something with Redis.
}
catch(\RedisException $e)
// Fall back to other db usage.
You'd know whether Redis is running or not. This is just a way to detect it on the fly.
Want to be a Linux expert? Come and join this Linux course
31k questions
32.8k answers
501 comments
693 users