57 lines
985 B
PHP
57 lines
985 B
PHP
<?php
|
|
|
|
|
|
namespace crmeb\services;
|
|
|
|
use think\facade\Cache;
|
|
|
|
/**
|
|
* crmeb 缓存类
|
|
* Class CacheService
|
|
* @package crmeb\services
|
|
* @mixin \Redis
|
|
* @mixin \think\cache\driver\Redis
|
|
*/
|
|
class RedisCacheService
|
|
{
|
|
|
|
/**
|
|
* @var \Redis
|
|
*/
|
|
protected $handler;
|
|
|
|
/**
|
|
* @var \think\cache\driver\Redis
|
|
*/
|
|
protected $driver;
|
|
|
|
/**
|
|
* @param int $admin
|
|
* @param string $tag
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->driver = Cache::store('redis');
|
|
$this->handler = $this->driver->handler();
|
|
}
|
|
|
|
public function handler()
|
|
{
|
|
return $this->handler;
|
|
}
|
|
|
|
public function driver()
|
|
{
|
|
return $this->driver;
|
|
}
|
|
|
|
public function __call($name, $arguments)
|
|
{
|
|
if (method_exists($this->driver, $name)) {
|
|
return call_user_func_array([$this->driver, $name], $arguments);
|
|
}
|
|
return call_user_func_array([$this->handler, $name], $arguments);
|
|
}
|
|
|
|
}
|