mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进Query类find和select方法的缓存处理
This commit is contained in:
@@ -29,12 +29,6 @@ return [
|
|||||||
'default_timezone' => 'PRC',
|
'default_timezone' => 'PRC',
|
||||||
// 是否开启多语言
|
// 是否开启多语言
|
||||||
'lang_switch_on' => false,
|
'lang_switch_on' => false,
|
||||||
// 支持的多语言列表
|
|
||||||
'lang_list' => ['zh-cn'],
|
|
||||||
// 语言变量
|
|
||||||
'lang_detect_var' => 'lang',
|
|
||||||
// 语言cookie变量
|
|
||||||
'lang_cookie_var' => 'think_lang',
|
|
||||||
// 默认全局过滤方法 用逗号分隔多个
|
// 默认全局过滤方法 用逗号分隔多个
|
||||||
'default_filter' => '',
|
'default_filter' => '',
|
||||||
// 自动Response输出
|
// 自动Response输出
|
||||||
|
|||||||
@@ -1235,10 +1235,7 @@ class Query
|
|||||||
$sql = $this->builder()->select($options);
|
$sql = $this->builder()->select($options);
|
||||||
// 执行查询操作
|
// 执行查询操作
|
||||||
$resultSet = $this->connection->query($sql, $this->getBind(), $options['fetch_sql'], $options['master'], $options['fetch_pdo']);
|
$resultSet = $this->connection->query($sql, $this->getBind(), $options['fetch_sql'], $options['master'], $options['fetch_pdo']);
|
||||||
}
|
|
||||||
|
|
||||||
// 返回结果处理
|
|
||||||
if (!empty($resultSet)) {
|
|
||||||
if (is_string($resultSet)) {
|
if (is_string($resultSet)) {
|
||||||
// 返回SQL
|
// 返回SQL
|
||||||
return $resultSet;
|
return $resultSet;
|
||||||
@@ -1252,6 +1249,10 @@ class Query
|
|||||||
// 缓存数据集
|
// 缓存数据集
|
||||||
Cache::set($key, $resultSet, $cache['expire']);
|
Cache::set($key, $resultSet, $cache['expire']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回结果处理
|
||||||
|
if (!empty($resultSet)) {
|
||||||
|
|
||||||
// 数据列表读取后的处理
|
// 数据列表读取后的处理
|
||||||
if (!empty($options['model'])) {
|
if (!empty($options['model'])) {
|
||||||
@@ -1311,10 +1312,7 @@ class Query
|
|||||||
$sql = $this->builder()->select($options);
|
$sql = $this->builder()->select($options);
|
||||||
// 执行查询
|
// 执行查询
|
||||||
$result = $this->connection->query($sql, $this->getBind(), $options['fetch_sql'], $options['master'], $options['fetch_pdo']);
|
$result = $this->connection->query($sql, $this->getBind(), $options['fetch_sql'], $options['master'], $options['fetch_pdo']);
|
||||||
}
|
|
||||||
|
|
||||||
// 数据处理
|
|
||||||
if (!empty($result)) {
|
|
||||||
if (is_string($result)) {
|
if (is_string($result)) {
|
||||||
// 返回SQL
|
// 返回SQL
|
||||||
return $result;
|
return $result;
|
||||||
@@ -1329,7 +1327,10 @@ class Query
|
|||||||
// 缓存数据
|
// 缓存数据
|
||||||
Cache::set($key, $result, $cache['expire']);
|
Cache::set($key, $result, $cache['expire']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数据处理
|
||||||
|
if (!empty($result)) {
|
||||||
$data = $result[0];
|
$data = $result[0];
|
||||||
if (!empty($options['model'])) {
|
if (!empty($options['model'])) {
|
||||||
// 返回模型对象
|
// 返回模型对象
|
||||||
|
|||||||
Reference in New Issue
Block a user