mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
修正model类的cache方法
This commit is contained in:
@@ -459,7 +459,7 @@ class Model
|
|||||||
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));
|
||||||
$data = Cache::get($key, '', $cache);
|
$data = Cache::get($key);
|
||||||
if (false !== $data) {
|
if (false !== $data) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@@ -493,7 +493,7 @@ class Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($cache)) {
|
if (isset($cache)) {
|
||||||
Cache::set($key, $resultSet, $cache);
|
Cache::set($key, $resultSet, $cache['expire']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $resultSet;
|
return $resultSet;
|
||||||
@@ -641,7 +641,7 @@ class Model
|
|||||||
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));
|
||||||
$data = Cache::get($key, '', $cache);
|
$data = Cache::get($key);
|
||||||
if (false !== $data) {
|
if (false !== $data) {
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
return $data;
|
return $data;
|
||||||
@@ -663,7 +663,7 @@ class Model
|
|||||||
// 数据对象赋值
|
// 数据对象赋值
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
if (isset($cache)) {
|
if (isset($cache)) {
|
||||||
Cache::set($key, $data, $cache);
|
Cache::set($key, $data, $cache['expire']);
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user