realbattletoad/yii2-redis

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Type:yii2-extension

1.0.4 2021-07-15 19:06 UTC

This package is auto-updated.

Last update: 2025-07-16 03:44:14 UTC


README

Fork of trorg/yii2-redis

Simple integration of phpredis.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist realbattletoad/yii2-redis:"1.*"

or add

"realbattletoad/yii2-redis": "1.*"

to the require section of your composer.json.

Configuration

To use this extension, you have to configure the Connection class in your application configuration:

Simple, with one server

return [
    //....
    'components' => [
        'redis' => [
            'class' => 'realbattletoad\yii2\redis\Connection',
            'servers' => [
                'server1:6379',
            ],
        ],
    ]
];

Redis cluster or Array distribution or Sentinels

return [
    //....
    'components' => [
        'redis' => [
            'class' => 'realbattletoad\yii2\redis\Connection',
            'servers' => [
                'server1:6379',
                'server2:6379',
                'server3:6379',
            ],
            'cluster' => 'redis', // or 'array' // or 'sentinels'
        ],
    ]
];