承接 sparq-php/cache 相关项目开发

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

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

sparq-php/cache

最新稳定版本:1.1.5

Composer 安装命令:

composer require sparq-php/cache

包简介

Cache made simple

README 文档

README

pipeline status Latest Stable Version coverage report Total Downloads License

A simple to use cache class.

Installation and Autoloading

The recommended method of installing is via Composer.

Run the following command from your project root:

$ composer require sparq-php/cache

Objectives

  • Simple to use cache
  • Easy integration with other packages/frameworks
  • Fast and low footprint

Usage

require_once __DIR__ . "/vendor/autoload.php";

use RedisClient\RedisClient;
use Sparq\Cache\AbstractCache;

class Foo extends AbstractCache
{
	public function events()
    {
        return [
            'before.get' => function ($key) {
            	if ('myObject' === $key) {
                    $this->set($key, (object) [
                        'some' => 'value',
                    ]);
                }

                if ('myArray' === $key) {
                    $this->set($key, [
                        'some' => 'value',
                    ]);
                }

                if ('some' === $key) {
                    $this->set($key, 'value');
                }
            }
		];
	}
}

$Foo = new Foo();
$Foo->register('memory', new \Sparq\Cache\Adapter\Memory(), 100);
$Foo->register('redis', new \Sparq\Cache\Adapter\RedisExtension(new Redis()), 50);
$Foo->register('redis', new \Sparq\Cache\Adapter\RedisPhpClient(new RedisClient()), 40);

echo $Foo->myObject->some;
echo $Foo->myArray['some'];
echo $Foo->some;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-08