<?php
$host = '';
$port = '';
$password = '';
$database = 0;
$value = '';
try {
$redis = new redis();
$redis->connect($host, $port);
if ($password !== null) {
$redis->auth($password);
}
$redis->select($database);
$value = $redis->get('key');
} catch (Exception $e) {
$value = '';
}
echo $value;