Skip to the content.

Laravel中间件-Response缓存

Latest Stable Version Total Downloads License 996.icu LICENSE

功能

安装

composer require flc/laravel-middleware-cache-response

配置

\app\Http\Kernel.php文件中$routeMiddleware增加:

<?php
'cache.response' => \Flc\Laravel\Http\Middleware\CacheResponse::class,

// cache.response 命名随意,你开心就好

使用

<?php
Route::get('/', function () {
    return view('welcome');
})->middleware('cache.response');

Route::get('/', function () {
    return view('welcome');
})->middleware('cache.response:20');  // 指定缓存时间20分钟

附录

缓存规则

Headers

X-Cache:Missed
X-Cache-Expires:2018-03-29 15:08:29 CST
X-Cache-Key:6c9b19774e2c304a42d200f314d8c80b

TODO

捐赠

如果你觉得本扩展对你有帮助,请捐赠以表支持,谢谢~~

微信

支付宝

License