first commit
This commit is contained in:
32
金壶/ydyd_service/application/common/RedisCache.php
Normal file
32
金壶/ydyd_service/application/common/RedisCache.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user