提交 5e12c653 编写于 作者: lzc828's avatar lzc828

del default

上级 3ddb2284
......@@ -21,8 +21,6 @@ class Redis extends Cache
private $retry_count = 3;
public $keep_default = false;
public function __construct($key = 'default')
{
$this->setConnection($key);
......@@ -89,12 +87,12 @@ class Redis extends Cache
{
try {
$rs = $this->pop();
$val = $rs->get($this->keep_default === false ? $this->getTagKey($key, $tags) : $key);
$val = $rs->get($this->getTagKey($key, $tags));
$this->push($rs);
if ((!$val) && $closure) {
$val = $closure();
$this->set($key, $val, $ttl, $tags);
} else if ($val && $this->keep_default === false) {
} else if ($val) {
$val = unserialize($val);
}
$this->setRetryCount();
......@@ -108,7 +106,7 @@ class Redis extends Cache
{
try {
if (is_string($key) && $this->keep_default === false) {
if (is_string($key)) {
$key = $this->getTagKey($key);
}
$rs = $this->pop();
......@@ -137,12 +135,8 @@ class Redis extends Cache
public function set($key, $val, $ttl = null, $tags = [])
{
try {
$rs = $this->pop();
if ($this->keep_default === false) {
$ret = $rs->set($this->getTagKey($key, $tags), serialize($val), $ttl);
} else {
$ret = $rs->set($key, $val, $ttl);
}
$rs = $this->pop();
$ret = $rs->set($this->getTagKey($key, $tags), serialize($val), $ttl);
$this->push($rs);
$this->setRetryCount();
return $ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册