mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
修正Query类的cache方法
This commit is contained in:
@@ -1044,12 +1044,14 @@ class Query
|
|||||||
$this->parsePkWhere($data, $options);
|
$this->parsePkWhere($data, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$resultSet = false;
|
||||||
if (isset($options['cache'])) {
|
if (isset($options['cache'])) {
|
||||||
// 判断查询缓存
|
// 判断查询缓存
|
||||||
$cache = $options['cache'];
|
$cache = $options['cache'];
|
||||||
$key = is_string($cache['key']) ? $cache['key'] : md5(serialize($options));
|
$key = is_string($cache['key']) ? $cache['key'] : md5(serialize($options));
|
||||||
$resultSet = Cache::get($key);
|
$resultSet = Cache::get($key);
|
||||||
} else {
|
}
|
||||||
|
if (!$resultSet) {
|
||||||
// 生成查询SQL
|
// 生成查询SQL
|
||||||
$sql = $this->builder()->select($options);
|
$sql = $this->builder()->select($options);
|
||||||
// 执行查询操作
|
// 执行查询操作
|
||||||
@@ -1116,13 +1118,14 @@ class Query
|
|||||||
}
|
}
|
||||||
|
|
||||||
$options['limit'] = 1;
|
$options['limit'] = 1;
|
||||||
|
$result = false;
|
||||||
if (isset($options['cache'])) {
|
if (isset($options['cache'])) {
|
||||||
// 判断查询缓存
|
// 判断查询缓存
|
||||||
$cache = $options['cache'];
|
$cache = $options['cache'];
|
||||||
$key = is_string($cache['key']) ? $cache['key'] : md5(serialize($options));
|
$key = is_string($cache['key']) ? $cache['key'] : md5(serialize($options));
|
||||||
$result = Cache::get($key);
|
$result = Cache::get($key);
|
||||||
} else {
|
}
|
||||||
|
if (!$result) {
|
||||||
// 生成查询SQL
|
// 生成查询SQL
|
||||||
$sql = $this->builder()->select($options);
|
$sql = $this->builder()->select($options);
|
||||||
// 执行查询
|
// 执行查询
|
||||||
|
|||||||
Reference in New Issue
Block a user