mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
增加请求缓存功能 路由支持设置请求缓存
This commit is contained in:
@@ -11,9 +11,11 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\Cache;
|
||||
use think\Config;
|
||||
use think\Debug;
|
||||
use think\Env;
|
||||
use think\Request;
|
||||
use think\response\Json as JsonResponse;
|
||||
use think\response\Jsonp as JsonpResponse;
|
||||
use think\response\Redirect as RedirectResponse;
|
||||
@@ -111,6 +113,14 @@ class Response
|
||||
}
|
||||
echo $data;
|
||||
|
||||
if (200 == $this->code) {
|
||||
$cache = Request::instance()->getCache();
|
||||
if ($cache) {
|
||||
Cache::set($cache[0], $data, $cache[1]);
|
||||
Cache::set($cache[0] . '_header', $this->header['Content-Type']);
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('fastcgi_finish_request')) {
|
||||
// 提高页面响应
|
||||
fastcgi_finish_request();
|
||||
|
||||
Reference in New Issue
Block a user