32 lines
702 B
PHP
32 lines
702 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: HIAPAD
|
|
* Date: 2018/9/6
|
|
* Time: 9:50
|
|
*/
|
|
|
|
namespace app\common;
|
|
|
|
use think\Cache;
|
|
use think\Loader;
|
|
|
|
class RedisCache extends Cache
|
|
{
|
|
//重写connect方法
|
|
public function connect(array $options = [], $name = false)
|
|
{
|
|
if (false === $name) {
|
|
$name = md5(serialize($options));
|
|
}
|
|
|
|
if (true === $name || !isset($this->instance[$name])) {
|
|
if (true === $name) {
|
|
$name = md5('CustomRedis'.serialize($options));
|
|
}
|
|
$this->instance[$name] = Loader::factory('CustomRedis', '\\app\\common\\driver\\', $options);
|
|
}
|
|
|
|
return $this->instance[$name];
|
|
}
|
|
} |