zfegg/page-cache-middleware

Static pages cache(using psr6) for psr7 middleware stack

0.1.0 2016-09-02 08:16 UTC

This package is not auto-updated.

Last update: 2024-04-13 17:07:58 UTC


README

Build Status Coverage Status Latest Stable Version

Cache using psr6. 缓存使用PSR6规范.

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

Installation / 安装

使用 Composer 安装

$ composer require zfegg/page-cache-middleware

Usage / 使用

//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

More see packagist PSR-6 providers.