commit | author | age
|
2207d6
|
1 |
<p align="center"> |
W |
2 |
<a href="http://redis.io/" target="_blank" rel="external"> |
|
3 |
<img src="http://download.redis.io/logocontest/82.png" height="100px"> |
|
4 |
</a> |
|
5 |
<h1 align="center">Redis Cache, Session and ActiveRecord for Yii 2</h1> |
|
6 |
<br> |
|
7 |
</p> |
|
8 |
|
|
9 |
This extension provides the [redis](http://redis.io/) key-value store support for the [Yii framework 2.0](http://www.yiiframework.com). |
|
10 |
It includes a `Cache` and `Session` storage handler and implements the `ActiveRecord` pattern that allows |
|
11 |
you to store active records in redis. |
|
12 |
|
|
13 |
For license information check the [LICENSE](LICENSE.md)-file. |
|
14 |
|
|
15 |
Documentation is at [docs/guide/README.md](docs/guide/README.md). |
|
16 |
|
|
17 |
[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-redis/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-redis) |
|
18 |
[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-redis/downloads.png)](https://packagist.org/packages/yiisoft/yii2-redis) |
|
19 |
[![Build Status](https://travis-ci.org/yiisoft/yii2-redis.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-redis) |
|
20 |
|
|
21 |
|
|
22 |
Requirements |
|
23 |
------------ |
|
24 |
|
|
25 |
At least redis version 2.6.12 is required for all components to work properly. |
|
26 |
|
|
27 |
Installation |
|
28 |
------------ |
|
29 |
|
|
30 |
The preferred way to install this extension is through [composer](http://getcomposer.org/download/). |
|
31 |
|
|
32 |
Either run |
|
33 |
|
|
34 |
``` |
|
35 |
php composer.phar require --prefer-dist yiisoft/yii2-redis:"~2.0.0" |
|
36 |
``` |
|
37 |
|
|
38 |
or add |
|
39 |
|
|
40 |
```json |
|
41 |
"yiisoft/yii2-redis": "~2.0.0" |
|
42 |
``` |
|
43 |
|
|
44 |
to the require section of your composer.json. |
|
45 |
|
|
46 |
|
|
47 |
Configuration |
|
48 |
------------- |
|
49 |
|
|
50 |
To use this extension, you have to configure the Connection class in your application configuration: |
|
51 |
|
|
52 |
```php |
|
53 |
return [ |
|
54 |
//.... |
|
55 |
'components' => [ |
|
56 |
'redis' => [ |
|
57 |
'class' => 'yii\redis\Connection', |
|
58 |
'hostname' => 'localhost', |
|
59 |
'port' => 6379, |
|
60 |
'database' => 0, |
|
61 |
], |
|
62 |
] |
|
63 |
]; |
|
64 |
``` |