承接 duncan3dc/cache 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

duncan3dc/cache

最新稳定版本:2.0.0

Composer 安装命令:

composer require duncan3dc/cache

包简介

Simple PSR-6/PSR-16 compatible disk cache

README 文档

README

A simple PSR-6/PSR-16 compatible disk cache for PHP

release build coverage

Installation

The recommended method of installing this library is via Composer.

Run the following command from your project root:

$ composer require duncan3dc/cache

Quick Examples

There are 2 cache providers available, one is the local filesystem and the other is simple array cache in memory.

Using the FilesystemPool will persist data forever (or until the filesystem is purged).

$cache = new \duncan3dc\Cache\FilesystemPool(sys_get_temp_dir());

# The $cache object implements PSR-6
$userData = $cache->getItem("user_data")->get();

# ...and PSR-16
$userData = $cache->get("user_data");

Using the ArrayPool will not persist data beyond the current request.

$cache = new \duncan3dc\Cache\ArrayPool();

# The $cache object implements PSR-6
$userData = $cache->getItem("user_data")->get();

# ...and PSR-16
$userData = $cache->get("user_data");

There's also a trait to allow any method to be automatically cached.

$cache = new class {
    use \duncan3dc\Cache\CacheCallsTrait;

    public function _getData()
    {
        return [];
    }
};

$cache->getData();

The first time getData() is called then _getData() will be run, but after that future calls to getData() will just return the cached result from the first call to _getData().

Changelog

A Changelog has been available since the beginning of time

Where to get help

Found a bug? Got a question? Just not sure how something works?
Please create an issue and I'll do my best to help out.
Alternatively you can catch me on Twitter

duncan3dc/cache for enterprise

Available as part of the Tidelift Subscription

The maintainers of duncan3dc/cache and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

统计信息

  • 总下载量: 71.31k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2017-03-13