Skip to content

Commit b0a658a

Browse files
eridiumdevsamdark
authored andcommitted
Add upgrade notes that include 2.0.10 instructions [skip ci]
1 parent 7d35404 commit b0a658a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

UPGRADE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Upgrading Instructions for Yii 2.0 Redis Extension
2+
3+
This file contains the upgrade notes for Yii 2.0 Redis Extension. These notes highlight changes that
4+
could break your application when you upgrade extension from one version to another.
5+
6+
Upgrading in general is as simple as updating your dependency in your composer.json and
7+
running `composer update`. In a big application however there may be more things to consider,
8+
which are explained in the following.
9+
10+
> Note: The following upgrading instructions are cumulative. That is,
11+
if you want to upgrade from version A to version C and there is
12+
version B between A and C, you need to follow the instructions
13+
for both A and B.
14+
15+
Upgrade from 2.0.10
16+
------------------
17+
yii2-redis now provides a better support for Redis in cluster mode.
18+
19+
If you're using redis in cluster mode and want to use `MGET` and `MSET` effectively, you will need to supply a
20+
[hash tag](https://redis.io/topics/cluster-spec#keys-hash-tags) to allocate cache keys to the same hash slot.
21+
```
22+
\Yii::$app->cache->multiSet([
23+
'posts{user1}' => 123,
24+
'settings{user1}' => [
25+
'showNickname' => false,
26+
'sortBy' => 'created_at',
27+
],
28+
'unreadMessages{user1}' => 5,
29+
]);
30+
```
31+
32+
You might also want to force cluster mode for every request by setting `'forceClusterMode' => true` in your Redis component config. Otherwise an implicit check that executes Redis command `'CLUSTER INFO'` will be made on each request.
33+
34+
If you do not intend on using Redis in cluster mode, it is advisable to set `'forceClusterMode' => false` to avoid additional overhead and possible troubles when extending `yii\redis\Connection::executeCommand`, because executing `'CLUSTER INFO'` will return an error on a single-node Redis.

0 commit comments

Comments
 (0)