<pre>
<?php
/**
* This is a Redis exntend class
*/
class RedisClient
{
private static $instance = NULL;
/**
* Get a instance of MyRedisClient
*
* @param string $key
* @return object
*/
public static function getInstance()
{
if (!self::$instance) {
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->auth('23');
self::$instance = $redis;
}
return self::$instance;
}
}
$redis = RedisClient::getInstance();
$redis->incr('moban_fangwen');
print_r($redis->get('moban_fangwen'));
exit();
?>
</pre>