This extension provides the redis key-value store support for the Yii framework 2.0.
It includes a Cache
and Session
storage handler in redis.
Notice: THIS REPO DOES NOT SUPPORT ACTIVE RECORD.
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist nuwber/yii2-phpredis
or add
"nuwber/yii2-phpredis": "^2.0"
to the require section of your composer.json.
To use this extension, you have to configure the Connection class in your application configuration:
return [
'components' => [
'redis' => [
'class' => \nuwber\yii2redis\Connection::class,
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
'cache' => [
'class' => \nuwber\yii2redis\Cache::class,
],
'session' => [
'class' => \nuwber\yii2redis\Session::class,
],
],
];
You can specific your redis config
$ cp tests/config.php tests/config-local.php
and Run
$ ./vendor/bin/phpunit
$ php tests/performance.php