|
@@ -24,15 +24,15 @@ class Redis extends Driver
|
|
|
|
|
|
/**
|
|
|
* 构造函数
|
|
|
- * @param array $options 缓存参数
|
|
|
* @throws \BadFunctionCallException
|
|
|
* @access public
|
|
|
*/
|
|
|
- public function __construct($options = [])
|
|
|
+ public function __construct()
|
|
|
{
|
|
|
if (!extension_loaded('redis')) {
|
|
|
throw new \BadFunctionCallException('not support: redis');
|
|
|
}
|
|
|
+ $options = config('redis');
|
|
|
if (!empty($options)) {
|
|
|
$this->options = array_merge($this->options, $options);
|
|
|
}
|
|
@@ -61,7 +61,7 @@ class Redis extends Driver
|
|
|
{
|
|
|
$config = \think\Config::get('token');
|
|
|
$token = $token ?? ''; // 为兼容 php8
|
|
|
- return $this->options['tokenprefix'] . hash_hmac($config['hashalgo'], $token, $config['key']);
|
|
|
+ return $this->options['prefix'] . $this->options['tokenprefix'] . hash_hmac($config['hashalgo'], $token, $config['key']);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -71,7 +71,7 @@ class Redis extends Driver
|
|
|
*/
|
|
|
protected function getUserKey($user_id)
|
|
|
{
|
|
|
- return $this->options['userprefix'] . $user_id;
|
|
|
+ return $this->options['prefix'] . $this->options['userprefix'] . $user_id;
|
|
|
}
|
|
|
|
|
|
/**
|