mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 16:12:49 +08:00
改进Request类cache方法
This commit is contained in:
@@ -1476,6 +1476,7 @@ class Request
|
||||
*/
|
||||
public function cache($key, $expire = null)
|
||||
{
|
||||
if ($this->isGet()) {
|
||||
if (false !== strpos($key, ':')) {
|
||||
$param = $this->param();
|
||||
foreach ($param as $item => $val) {
|
||||
@@ -1498,6 +1499,7 @@ class Request
|
||||
$this->cache = [$key, $expire];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取缓存设置
|
||||
|
||||
@@ -115,7 +115,7 @@ class Response
|
||||
|
||||
if (200 == $this->code) {
|
||||
$cache = Request::instance()->getCache();
|
||||
if ($cache && Request::instance()->isGet()) {
|
||||
if ($cache) {
|
||||
Cache::set($cache[0], $data, $cache[1]);
|
||||
Cache::set($cache[0] . '_header', $this->header['Content-Type']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user