Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
flc1125 committed Mar 29, 2018
1 parent 021e191 commit 0363cc8
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,59 @@
# laravel-middleware-response-cache
# Laravel中间件-Response缓存

Laravel中间件-Response缓存(进行中...ing...)
## 功能

- 支持缓存渲染后数据
- 支持指定缓存过期时间(默认10分钟)
- header头输出缓存命中状态、缓存Key及过期时间

## 安装

```sh
composer require flc/laravel-middleware-cache-response
```

> 进行中-不稳定版本
## 配置

> `\app\Http\Kernel.php`文件中`$routeMiddleware`增加:
```php
<?php
'cache.response' => \Flc\Laravel\Http\Middleware\CacheResponse::class,

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

## 使用

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

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

## 附录

**缓存规则**

- 当前URL全路径md5

**Headers**

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

## TODO

- 增加`status``header`的支持

## Licenes

MIT

0 comments on commit 0363cc8

Please sign in to comment.