缓存驱动统一增加handler方法用于获取操作对象的句柄(某些缓存类型可能为null)

This commit is contained in:
thinkphp
2016-09-29 18:01:22 +08:00
parent f98415ad45
commit 13ed82e5dd
6 changed files with 12 additions and 16 deletions

View File

@@ -16,6 +16,7 @@ namespace think\cache;
*/ */
abstract class Driver abstract class Driver
{ {
protected $handler = null;
protected $options = []; protected $options = [];
protected $tag; protected $tag;
@@ -173,4 +174,15 @@ abstract class Driver
return []; return [];
} }
} }
/**
* 返回句柄对象,可执行其它高级方法
*
* @access public
* @return object
*/
public function handler()
{
return $this->handler;
}
} }

View File

@@ -16,7 +16,6 @@ use think\Exception;
class Memcache extends Driver class Memcache extends Driver
{ {
protected $handler = null;
protected $options = [ protected $options = [
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 11211, 'port' => 11211,

View File

@@ -15,7 +15,6 @@ use think\cache\Driver;
class Memcached extends Driver class Memcached extends Driver
{ {
protected $handler;
protected $options = [ protected $options = [
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 11211, 'port' => 11211,

View File

@@ -22,7 +22,6 @@ use think\cache\Driver;
*/ */
class Redis extends Driver class Redis extends Driver
{ {
protected $handler = null;
protected $options = [ protected $options = [
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 6379, 'port' => 6379,
@@ -174,14 +173,4 @@ class Redis extends Driver
return $this->handler->flushDB(); return $this->handler->flushDB();
} }
/**
* 返回句柄对象,可执行其它高级方法
*
* @access public
* @return object
*/
public function handler()
{
return $this->handler;
}
} }

View File

@@ -20,7 +20,6 @@ use think\Exception;
*/ */
class Sqlite extends Driver class Sqlite extends Driver
{ {
protected $options = [ protected $options = [
'db' => ':memory:', 'db' => ':memory:',
'table' => 'sharedmemory', 'table' => 'sharedmemory',

View File

@@ -25,8 +25,6 @@ class Wincache extends Driver
'expire' => 0, 'expire' => 0,
]; ];
protected $tag;
/** /**
* 架构函数 * 架构函数
* @param array $options 缓存参数 * @param array $options 缓存参数