内核代码升级
This commit is contained in:
@@ -403,7 +403,11 @@ class Query
|
||||
$result = $pdo->fetchColumn();
|
||||
if (isset($cache)) {
|
||||
// 缓存数据
|
||||
Cache::set($key, $result, $cache['expire']);
|
||||
if (isset($cache['tag'])) {
|
||||
Cache::tag($cache['tag'])->set($key, $result, $cache['expire']);
|
||||
} else {
|
||||
Cache::set($key, $result, $cache['expire']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 清空查询条件
|
||||
@@ -468,7 +472,11 @@ class Query
|
||||
}
|
||||
if (isset($cache) && isset($guid)) {
|
||||
// 缓存数据
|
||||
Cache::set($guid, $result, $cache['expire']);
|
||||
if (isset($cache['tag'])) {
|
||||
Cache::tag($cache['tag'])->set($guid, $result, $cache['expire']);
|
||||
} else {
|
||||
Cache::set($guid, $result, $cache['expire']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 清空查询条件
|
||||
@@ -999,7 +1007,8 @@ class Query
|
||||
if (!$simple) {
|
||||
$options = $this->getOptions();
|
||||
$total = $this->count();
|
||||
$results = $this->options($options)->page($page, $listRows)->select();
|
||||
$bind = $this->bind;
|
||||
$results = $this->options($options)->bind($bind)->page($page, $listRows)->select();
|
||||
} else {
|
||||
$results = $this->limit(($page - 1) * $listRows, $listRows + 1)->select();
|
||||
$total = null;
|
||||
@@ -1067,9 +1076,10 @@ class Query
|
||||
* @access public
|
||||
* @param mixed $key 缓存key
|
||||
* @param integer $expire 缓存有效期
|
||||
* @param string $tag 缓存标签
|
||||
* @return $this
|
||||
*/
|
||||
public function cache($key = true, $expire = null)
|
||||
public function cache($key = true, $expire = null, $tag = null)
|
||||
{
|
||||
// 增加快捷调用方式 cache(10) 等同于 cache(true, 10)
|
||||
if (is_numeric($key) && is_null($expire)) {
|
||||
@@ -1077,7 +1087,7 @@ class Query
|
||||
$key = true;
|
||||
}
|
||||
if (false !== $key) {
|
||||
$this->options['cache'] = ['key' => $key, 'expire' => $expire];
|
||||
$this->options['cache'] = ['key' => $key, 'expire' => $expire, 'tag' => $tag];
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
@@ -1363,7 +1373,7 @@ class Query
|
||||
$tableName = $this->parseSqlTable($tableName);
|
||||
}
|
||||
|
||||
$guid = $tableName;
|
||||
list($guid) = explode(' ', $tableName);
|
||||
if (!isset(self::$info[$guid])) {
|
||||
$info = $this->connection->getFields($tableName);
|
||||
$fields = array_keys($info);
|
||||
@@ -1881,7 +1891,11 @@ class Query
|
||||
|
||||
if (isset($cache)) {
|
||||
// 缓存数据集
|
||||
Cache::set($key, $resultSet, $cache['expire']);
|
||||
if (isset($cache['tag'])) {
|
||||
Cache::tag($cache['tag'])->set($key, $resultSet, $cache['expire']);
|
||||
} else {
|
||||
Cache::set($key, $resultSet, $cache['expire']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1968,7 +1982,11 @@ class Query
|
||||
|
||||
if (isset($cache)) {
|
||||
// 缓存数据
|
||||
Cache::set($key, $result, $cache['expire']);
|
||||
if (isset($cache['tag'])) {
|
||||
Cache::tag($cache['tag'])->set($key, $result, $cache['expire']);
|
||||
} else {
|
||||
Cache::set($key, $result, $cache['expire']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user