Пример #1
0
    }
    public function __destruct()
    {
        if ($this->conn) {
            phpiredis_disconnect($this->conn);
        }
    }
}
$db = new redis("127.0.0.1", 6379);
$rc = $db->connect();
if (!$rc) {
    echo "can not connect redis server\r\n";
    exit;
}
$data = array("name" => "qiye", "age" => 18);
var_dump($db->hmset("key", $data));
var_dump($db->hgetall("key"));
/*
$value = array("name"=>"qiye", "age"=>18);
$db->hmset("user:1", $value);


$data = $db->multi(array('DEL test', 'SET test 1', 'GET test'));
print_r($data);
//echo $db->set("name", "value");
//echo $db->get("name");
$db->ds_set("name", "qiangjian");
$db->ds_set("nickname", "qiye");
$data = $db->ds_mget( "name", "nickname");
print_r($data);
*/