Commit 32d82f59 by Paul Klimov

Code style at redis readme fixed.

parent ece5f0b8
......@@ -44,17 +44,17 @@ to the require section of your composer.json.
Using the Cache component
-------------------------
To use the `Cache` component, in addtition to configuring the connection as described above,
To use the `Cache` component, in addition to configuring the connection as described above,
you also have to configure the `cache` component to be `yii\redis\Cache`:
```php
return [
//....
'components' => [
// ...
'cache' => [
'class' => 'yii\redis\Cache',
],
// ...
'cache' => [
'class' => 'yii\redis\Cache',
],
]
];
```
......@@ -66,15 +66,15 @@ cache component (no connection application component needs to be configured in t
return [
//....
'components' => [
// ...
'cache' => [
'class' => 'yii\redis\Cache',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
// ...
'cache' => [
'class' => 'yii\redis\Cache',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
]
];
```
......@@ -89,10 +89,10 @@ you also have to configure the `session` component to be `yii\redis\Session`:
return [
//....
'components' => [
// ...
'session' => [
'class' => 'yii\redis\Session',
],
// ...
'session' => [
'class' => 'yii\redis\Session',
],
]
];
```
......@@ -104,15 +104,15 @@ cache component (no connection application component needs to be configured in t
return [
//....
'components' => [
// ...
'session' => [
'class' => 'yii\redis\Session',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
// ...
'session' => [
'class' => 'yii\redis\Session',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
]
];
```
......@@ -134,29 +134,29 @@ The following is an example model called `Customer`:
```php
class Customer extends \yii\redis\ActiveRecord
{
/**
* @return array the list of attributes for this record
*/
public function attributes()
{
return ['id', 'name', 'address', 'registration_date'];
}
/**
* @return ActiveRelation defines a relation to the Order record (can be in other database, e.g. elasticsearch or sql)
*/
public function getOrders()
{
return $this->hasMany(Order::className(), ['customer_id' => 'id']);
}
/**
* Defines a scope that modifies the `$query` to return only active(status = 1) customers
*/
public static function active($query)
{
$query->andWhere(array('status' => 1));
}
/**
* @return array the list of attributes for this record
*/
public function attributes()
{
return ['id', 'name', 'address', 'registration_date'];
}
/**
* @return ActiveRelation defines a relation to the Order record (can be in other database, e.g. elasticsearch or sql)
*/
public function getOrders()
{
return $this->hasMany(Order::className(), ['customer_id' => 'id']);
}
/**
* Defines a scope that modifies the `$query` to return only active(status = 1) customers
*/
public static function active($query)
{
$query->andWhere(array('status' => 1));
}
}
```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment