ancor / yii2-redis
Redis component for Yii2
Installs: 126
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ^2.0
This package is not auto-updated.
Last update: 2024-11-09 20:01:39 UTC
README
Description
This component is wrapper, it based on really powerful php-redis extension.
Please, install those php-extension before use this.
Documentation can be found at here
Feel free to let me know what else you want added via:
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require ancor/yii2-redis
or add
"ancor/yii2-redis": "dev-master"
to the require
section of your composer.json
file.
Configuration
Configuration is easy. Add this to your main-local.php
config
'components' => [ 'redis' => \redis\redis\Redis::build(), ],
Or with settings
'components' => [ 'redis' => \redis\redis\Redis::build([ // 'host' => '127.0.0.1', // 'port' => 6379, // 'timeout' => 0, // 'retryInterval' => null, // 'password' => null, // 'database' => 0, // default database number ]), ],
Usage
$redis = Yii::$app->redis; $redis->set('my:key', 'some-value'); $res = $redis->get('my:key');