g4/russian-doll

russian-doll PHP 库

0.4.6 2019-09-06 06:22 UTC

This package is not auto-updated.

Last update: 2024-09-21 06:21:13 UTC


README

russian-doll - 缓存模式 php 库 - 受 rails/cache_digests 启发

安装

通过 composer 包管理器安装。在 packagist 上找到它。

composer require g4/russian-doll

依赖项

用法

查看 mcache 文档以获取详细信息 - mcache

<?php

$mcache = \G4\Mcache\McacheFactory::createInstance($driverName, $options, $prefix);

$key = \G4\RussianDoll\Key('posts');
$key
    ->addVariablePart($perPage)
    ->addVariablePart($page);

$russianDoll = new \G4\RussianDoll\RussianDoll($mcache);
$russianDoll->setKey($key);

// get data from cache
$posts = $russianDoll->fetch();

// write data to cache
$russianDoll->write($posts);

// invalidate cache entry
$russianDoll->expire();

开发

安装依赖项

$ make install

运行测试

$ make test

许可证

(MIT 许可证) 详情见 LICENSE 文件...