https://github.com/nuwber/yii2-phpredis
Redis Cache and Session for Yii2
https://github.com/nuwber/yii2-phpredis
phpredis redis yii2 yii2-extension
Last synced: 6 months ago
JSON representation
Redis Cache and Session for Yii2
- Host: GitHub
- URL: https://github.com/nuwber/yii2-phpredis
- Owner: nuwber
- Fork: true (dcb9/yii2-phpredis)
- Created: 2019-06-26T11:15:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-13T10:03:32.000Z (over 4 years ago)
- Last Synced: 2025-01-18T11:12:29.293Z (about 1 year ago)
- Topics: phpredis, redis, yii2, yii2-extension
- Language: PHP
- Size: 83 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Redis Cache and Session for Yii2
======================
This extension provides the [redis](http://redis.io/) key-value store support for the [Yii framework 2.0](http://www.yiiframework.com).
It includes a `Cache` and `Session` storage handler in redis.
[](https://github.com/nuwber/yii2-phpredis/actions/workflows/build.yml)
[](https://codecov.io/gh/nuwber/yii2-phpredis)
**Notice: THIS REPO DOES NOT SUPPORT ACTIVE RECORD.**
Installation
------------
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```bash
composer require --prefer-dist nuwber/yii2-phpredis
```
or add
```json
"nuwber/yii2-phpredis": "^2.0"
```
to the require section of your composer.json.
Configuration
-------------
To use this extension, you have to configure the Connection class in your application configuration:
```php
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,
],
],
];
```
Run unit test
-------------
You can specific your redis config
```bash
$ cp tests/config.php tests/config-local.php
```
and Run
```bash
$ ./vendor/bin/phpunit
```
Performance test
------------------
```
$ php tests/performance.php
```
