Redisの参照
1521 ワード
class PhpRedis extends redis{
//redis 16
static $dbs = array('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15',);
public function __construct(){
try{
//redis ,
$this->connect($redis_cachehost, $redis_cacheport);
//
$this->auth($redis_passport);
}cache(Exception $e){
log_message('REDIS ERROR', $e->__toString(), 'redis');
}
}
//
static private $obCore = '';
static function getInstance(){
if(self::$obCore == NULL){
self::$obCore = new self();
}
return self::$obCore;
}
}
// :log_message() ,
function log_message($type, $var, $file = '')
{
$dir = ROOT . '/log/'; //ROOT
if (!$file) {
$dir .= date("Y") . '/' . date("m") . '/' . date('d');
mkdirs($dir);
$file = $dir . '/' . date("Ymd") . ".log";
} else {
$file = $dir . TEMPLATE . '_' . $file . '.log';
}
$sh = fopen($file, "a");
$var = "[$type] " . date('Y-m-d H:i:s') . ' : ' . $var . "
";
fwrite($sh, $var, strlen($var));
fclose($sh);
}