sylweriusz/webcache-middleware
Composer 安装命令:
composer require sylweriusz/webcache-middleware
包简介
Static aka Html pages cache for Slim3 middleware stack
README 文档
README
Static pages cache for Slim3 middleware stack
WebCache will save only GET request with status 200.
Install
$ composer require sylweriusz/webcache-middleware
Usage
Declare middleware
$app->add(new \Slim\Middleware\WebcacheRedis('192.168.1.12:6379'));
Cache will try to detect ID of document, first numerical value in url parts.
Example: http://example.org/article/123456/title.html after detection ID = 123456
and if it fail to detect it will assume ID = 0
if You want to delete all articles with this ID You should do something like this
$webcache = new \Slim\Middleware\WebcacheRedis('192.168.1.12:6379'); $webcache->delete(123456);
Disabling cache inside application route
\Slim\Middleware\WebcacheRedis::setTtl(0);
Change default TTL (in seconds) inside application route
\Slim\Middleware\WebcacheRedis::setTtl(600);
Smarty plugin
Define parts of html that should be always fresh, no mather what.
<body> <div class="right-content"> {fresh id="reusable_box"}some html content{/fresh} </div>
You can even declare them empty (as readonly) on another page and hope it will just work.
<body> <div class="right-content"> {fresh id="reusable_box" readonly=1}{/fresh} </div>
统计信息
- 总下载量: 119
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2016-04-04