boesing/zend-cache-redis-cluster

此包已被放弃,不再维护。作者建议使用 laminas/laminas-cache-storage-adapter-redis 包。

为zend-cache提供Redis集群支持

v0.2.1 2021-07-09 10:46 UTC

This package is auto-updated.

Last update: 2021-07-09 10:49:24 UTC


README

Build Status Coverage Status

zendframework/zend-cache 适配器,为使用 zend-cache 的项目提供 RedisCluster 支持。

安装

composer require boesing/zend-cache-redis-cluster

配置

use Boesing\ZendCacheRedisCluster\RedisCluster;

return [
    'caches' => [
        /**
         * NOTE: the cluster nodename must exist in your php.ini!
         * If you configure timeout in your php.ini per nodename aswell, there is no need to
         * configure more than the nodename.
         */
        'redis-cluster-cache-with-nodename' => [
            'adapter' => [
                'name' => RedisCluster::class,
                'options' => [
                    'namespace' => '',
                    'namespace_separator' => ':',
                    'nodename' => 'clusternode1',
                    'persistent' => false,
                    // You can provide the redis version by configuration to avoid an info call on each connect
                    'redis_version' => '',
                ],
            ],
        ],
        'redis-cluster-cache-with-seeds' => [
            'adapter' => [
                'name' => RedisCluster::class,
                'options' => [
                    'namespace' => '',
                    'namespace_separator' => ':',
                    'seeds' => ["hostname:port", "hostname2:port2", /* ... */],
                    'timeout' => 1,
                    'readTimeout' => 2,
                    'persistent' => false,
                    // You can provide the redis version by configuration to avoid an info call on each connect
                    'redis_version' => '',
                ],
            ],
        ],
    ],
];