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:
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 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
]),
],
$redis = Yii::$app->redis;
$redis->set('my:key', 'some-value');
$res = $redis->get('my:key');