增加请求缓存功能 路由支持设置请求缓存

This commit is contained in:
thinkphp
2016-09-24 18:14:59 +08:00
parent 13b345c889
commit 450d7ab313
3 changed files with 43 additions and 2 deletions

View File

@@ -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();