承接 cytec/laminas-cache-predis 相关项目开发

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

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

cytec/laminas-cache-predis

最新稳定版本:2.0.0

Composer 安装命令:

composer require cytec/laminas-cache-predis

包简介

Redis adapter for Laminas Framework 3 with tagging support

README 文档

README

Redis adapter for Laminas framework with tagging support

Installation

composer require cytec/laminas-cache-predis

Configuration

Somewhere in your configuration (eg. config/autoload/global.php) add

...
'caches' => [
    'AppCache' => [
        'adapter' => 'Cytec\Cache\Storage\Adapter\Predis',
        'options' => [
            'ttl' => 600,
            'predis_client_connections' => [
                'host' => '127.0.0.1',
                'port' => 6379,
            ],
            'predis_client_options' => [
                'profile' => '2.4',
                'prefix'  => 'ns:'
            ]
        ],
        'plugins' => [
            ['name' => 'serializer']
        ],
    ]
],
...

Since laminas-cache v3 storage adapters need to be registered as modules:

modules.config.php:

<?php

return [
    ...{your other modules}...
    'Cytec\Cache\Storage\Adapter\Predis',
];

The predis_client_connections option is passed directly as the first argument when creating the Predis client and predis_client_options as the second parameter:

$client = new Predis\Client($predis_client_connections, $predis_client_options);

For more information check out Predis documentation on Connection Parameters and Client Options

And then you can get the cache via the service manager:

$cache = $this->getServiceManager()->get('AppCache');
$cache->setItem($key, $value);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2020-03-06