Redis connection test script

Written by

in

,


"tcp",
"host" => "127.0.0.1",
"port" => 6379));
*/
echo "Connected to Redis";
}
catch (Exception $e) {
echo "Unable to connect to Redis";
echo $e->getMessage();
}

$redis->set("var1", "The value for var1 is me");
echo $redis->get("var1");

// You can alos use exits() function to test if a variable exists or not
echo ($redis->exists("var2")) ? "true" : "false";

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *