You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
613 B
28 lines
613 B
<?php
|
|
/**
|
|
* redis模型层
|
|
* @package model
|
|
*/
|
|
|
|
class mRedis extends Redis{
|
|
// 实例
|
|
protected static $_instance = null;
|
|
|
|
/**
|
|
* Singleton instance(获取自己的实例)
|
|
*
|
|
* @return RedisOperate
|
|
*/
|
|
public static function getInstance($cnf) {
|
|
if (null === self::$_instance) {
|
|
self::$_instance = new self();
|
|
|
|
$res = self::$_instance->connect($cnf['host'], $cnf['port']);
|
|
if(!$res) {
|
|
$this->setError('redis_connect');
|
|
return false;
|
|
}
|
|
}
|
|
return self::$_instance;
|
|
}
|
|
}
|
|
|