zfegg/page-cache-middleware

静态页面缓存(使用psr6)用于psr7中间件栈

0.1.0 2016-09-02 08:16 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:31:19 UTC


README

Build Status Coverage Status Latest Stable Version

使用psr6进行缓存。缓存使用PSR6规范。

常见实例用于缓存程序生成的json,html,xml等

安装 / 安装

使用 Composer 安装

$ composer require zfegg/page-cache-middleware

使用 / 使用

//Array cache
$cacheData = [];
$cacheItemPool = new ArrayCachePool(null, $cacheData);

$middleware = new PageCacheMiddleware(
    $cacheItemPool, //PSR6 cache
    function ($key, $request) {  //Rename cache item key.
        return md5($key);
    },
    60  //Page cache ttl.
);

详细信息可参考写的slimphp 范例

实现了PSR-6的有:

更多信息请查看Packagist PSR-6提供者