承接 koded/cache-extended 相关项目开发

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

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

koded/cache-extended

Composer 安装命令:

composer require koded/cache-extended

包简介

A PSR-6 caching library with support for several caching technologies.

README 文档

README

Latest Stable Version Build Status Code Coverage Scrutinizer Code Quality Minimum PHP Version Software license

A PSR-6 caching library for PHP 7 using several caching technologies.

Requirements

  • Linux machine
  • PHP 8

Recommended cache technologies are

  • Redis server
  • Memcached

Recommended PHP modules

For developing purposes you can use

  • Memory client (default)
  • File client

Usage

  • create an instance of CacheItemPoolInterface with desired caching technology
  • manipulate the cache items with the pool instance
$cache = CachePool::use('redis');

$item = $cache->getItem('fubar');
$item->set('some value');
$item->expiresAfter(new DateTime('3 days'));

$cache->save();

The pool instance is created only once.

CachePool::use() accepts specific parameters for the underlying caching technology.
This method uses the Koded Simple Cache package. Please see the README in that repository for the specific arguments.

You can grab the cache client if you want to use it directly

/** $var Koded\Caching\Cache $client */
$client = $cache->client();

Deferring the items

To postpone the saving of the cache items (store all items "at once"), you can use the saveDeferred() method. These cache items are saved when you

  • execute commit()
  • when CacheItemPoolInterface instance is destroyed

Keep in mind that commit() is not an atomic operation. There is no guarantee that all items will be saved, because anything can happen while save() runs (network, client crash, etc).

$cache->saveDeferred($event);
$cache->saveDeferred($counter);

// ... do some stuff

// store this now
$cache->save($dependency);

// ... do more stuff

$cache->saveDeferred($updates);
$cache->saveDeferred($extras);

// Store all deferred items
$cache->commit();

License

The code is distributed under the terms of The 3-Clause BSD license.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-10-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固