-
-
Notifications
You must be signed in to change notification settings - Fork 184
added support for predis #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 35 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
962252d
Merge commit from fork
samdark d5b89cb
release version 2.0.20
samdark 0a90a54
prepare for next release
samdark bce389e
update tests
antonshevelev cb795ed
predis conn
antonshevelev 5dfa1cf
predis standalone and sentinel
antonshevelev 721fad7
ConnectionInterface
antonshevelev ddd8467
ConnectionInterface
antonshevelev 9d8d059
fix test
antonshevelev 6a1e916
PredisConnection
antonshevelev a16bbf6
predis on supported replicas
antonshevelev c48ee8a
code style
antonshevelev e5f0a66
del
antonshevelev 8d709a3
comments
antonshevelev a7dcd7d
docs
antonshevelev 5f4fef3
build
antonshevelev 8f2a33b
build
antonshevelev fbadba2
build
antonshevelev 8a389fc
build
antonshevelev 3296606
build
antonshevelev 631ef1b
build
antonshevelev f635042
build
antonshevelev abe55a7
build
antonshevelev 285e192
build
antonshevelev 351fa25
build
antonshevelev 3f489e3
build
antonshevelev 73a2312
fix test
antonshevelev f8d0a92
fix test
antonshevelev 9cc9efb
remove test
antonshevelev 76fcc88
fix test
antonshevelev 9a318ee
returned and fix testConnectionTimeout
antonshevelev c002b14
comment
antonshevelev a192ce2
fix
antonshevelev 04d54d2
Merge branch '22' into yii2-predis
antonshevelev 5d0e4a1
fix tests
antonshevelev 582264e
Update docs/guide-ja/README.md
antonshevelev 649c010
Update docs/guide-ru/topics-predis-cache.md
antonshevelev 952d60a
Update docs/guide-ru/topics-predis-session.md
antonshevelev aa6743b
Update docs/guide-ru/predis.md
antonshevelev faf8173
Update docs/guide/README.md
antonshevelev 8407d90
translation of guide
antonshevelev 9fb3962
upd guide
antonshevelev 3b22ac8
remove php.ini
antonshevelev 0745170
upd tests
antonshevelev 4f4a01a
upd CommandDecorator
antonshevelev eb4e18a
upd
antonshevelev c0ed9d9
upd readme
antonshevelev c9a1ed3
upd changelog
antonshevelev 80646e1
fix test
antonshevelev 6070b6d
Update docs/guide/predis.md
samdark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| Predis для Redis Cache, Session и ActiveRecord | ||
antonshevelev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| =============================================== | ||
| ## Конфигурирование приложения | ||
|
|
||
| Чтобы использовать это расширение, вам необходимо настроить класс [[yii\redis\predis\PredisConnection]] в конфигурации вашего приложения: | ||
|
|
||
| > [!WARNING] | ||
| > Класс yii\redis\predis\PredisConnection поддерживает подключение redis-cluster, но не даёт поддержки интерфейсов компонентов *cache*, *session*, *ActiveRecord*, *mutex* | ||
| ### standalone | ||
| ```php | ||
| return [ | ||
| //.... | ||
| 'components' => [ | ||
| 'redis' => [ | ||
| 'class' => 'yii\redis\predis\PredisConnection', | ||
| 'parameters' => 'tcp://redis:6379', | ||
| 'options' => [ | ||
| 'parameters' => [ | ||
| 'password' => 'secret', // Or NULL | ||
| 'database' => 0, | ||
| 'persistent' => true, | ||
| 'async_connect' => true, | ||
| 'read_write_timeout' => 0.1, | ||
| ], | ||
| ], | ||
| ], | ||
| ] | ||
| ]; | ||
| ``` | ||
| ### sentinel | ||
| ```php | ||
| return [ | ||
| //.... | ||
| 'components' => [ | ||
| 'redis' => [ | ||
| 'class' => 'yii\redis\predis\PredisConnection', | ||
| 'parameters' => [ | ||
| 'tcp://redis-node-1:26379', | ||
| 'tcp://redis-node-2:26379', | ||
| 'tcp://redis-node-3:26379', | ||
| ], | ||
| 'options' => [ | ||
| 'parameters' => [ | ||
| 'password' => 'secret', // Or NULL | ||
| 'database' => 0, | ||
| 'persistent' => true, | ||
| 'async_connect' => true, | ||
| 'read_write_timeout' => 0.1, | ||
| ], | ||
| ], | ||
| ], | ||
| ] | ||
| ]; | ||
| ``` | ||
|
|
||
| > Больше информации можно о конфигурации подключения и опциях можно получить в документации <a href="https://github.com/predis/predis">predis</a>. | ||
| Это обеспечивает базовый доступ к redis-хранилищу через компонент приложения `redis`: | ||
|
|
||
| ```php | ||
| Yii::$app->redis->set('mykey', 'some value'); | ||
| echo Yii::$app->redis->get('mykey'); | ||
| ``` | ||
|
|
||
| Дополнительно | ||
| ----------------- | ||
|
|
||
| * [Использование компонента Cache с predis](topics-predis-cache.md) | ||
| * [Использование компонента Session с predis](topics-predis-session.md) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| Использование компонента Cache в месте с predis | ||
| ========================= | ||
|
|
||
| Чтобы использовать компонент `Cache`, в дополнение к настройке соединения, как описано в разделе [predis](predis.md), вам также нужно настроить компонент `cache` как [[yii\redis\Cache]]: | ||
|
|
||
| ```php | ||
| return [ | ||
| //.... | ||
| 'components' => [ | ||
| // ... | ||
| 'redis' => [ | ||
| 'class' => 'yii\redis\predis\PredisConnection', | ||
| 'parameters' => 'tcp://redis:6379', | ||
| // ... | ||
| ], | ||
| 'cache' => [ | ||
| 'class' => 'yii\redis\Cache', | ||
| ], | ||
| ] | ||
| ]; | ||
| ``` | ||
|
|
||
| Если вы используете только кеш redis (т.е. не используете его ActiveRecord или Session), вы также можете настроить параметры соединения в пределах кеш-компонента (в этом случае необходимо настроить конфигурационный компонент подключения): | ||
|
|
||
| ```php | ||
| return [ | ||
| //.... | ||
| 'components' => [ | ||
| // ... | ||
| 'cache' => [ | ||
| 'class' => 'yii\redis\Cache', | ||
| 'redis' => [ | ||
| 'class' => 'yii\redis\predis\PredisConnection', | ||
| 'parameters' => 'tcp://redis:6379', | ||
| // ... | ||
| ], | ||
| ], | ||
| ] | ||
| ]; | ||
| ``` | ||
|
|
||
| Кэш предоставляет все методы [[yii\caching\CacheInterface]]. Если вы хотите получить доступ к определенным redis методам, которые не присутствуют | ||
| в интерфейсе, вы можете использовать их через [[yii\redis\Cache::$redis]], который является экземпляром [[yii\redis\Connection]]: | ||
|
|
||
| ```php | ||
| Yii::$app->cache->redis->hset('mykey', 'somefield', 'somevalue'); | ||
| Yii::$app->cache->redis->hget('mykey', 'somefield'); | ||
| ... | ||
| ``` | ||
|
|
||
| Смотри [[yii\redis\Connection]] для получения полного списка доступных методов. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| Использование компонента Session в месте с predis | ||
| =========================== | ||
|
|
||
| Чтобы использовать компонент `Session`, в дополнение к настройке соединения, как описано в разделе [predis](predis.md), вам также нужно настроить компонент `session` как [[yii\redis\Session]]: | ||
|
|
||
| ```php | ||
| return [ | ||
| //.... | ||
| 'components' => [ | ||
| // ... | ||
| 'redis' => [ | ||
| 'class' => 'yii\redis\predis\PredisConnection', | ||
| 'parameters' => 'tcp://redis:6379', | ||
| // ... | ||
| ], | ||
| 'session' => [ | ||
| 'class' => 'yii\redis\Session', | ||
| ], | ||
| ] | ||
| ]; | ||
| ``` | ||
|
|
||
| Если вы используете только redis сессии (т.е. не используете его ActiveRecord или Cache), вы также можете настроить параметры соединения в компоненте сеанса (в этом случае не нужно настраивать компонент приложения подключения): | ||
|
|
||
| ```php | ||
| return [ | ||
| //.... | ||
| 'components' => [ | ||
| // ... | ||
| 'session' => [ | ||
| 'class' => 'yii\redis\Session', | ||
| 'redis' => [ | ||
| 'class' => 'yii\redis\predis\PredisConnection', | ||
| 'parameters' => 'tcp://redis:6379', | ||
| // ... | ||
| ], | ||
| ], | ||
| ] | ||
| ]; | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ Iniciando | |
| --------------- | ||
|
|
||
| * [Instalação](installation.md) | ||
| * [Поддержка predis](predis.md) | ||
|
|
||
| Uso | ||
| ----- | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| Predis для Redis Cache, Session и ActiveRecord | ||
| =============================================== | ||
| ## Конфигурирование приложения | ||
|
|
||
| Чтобы использовать это расширение, вам необходимо настроить класс [[yii\redis\predis\PredisConnection]] в конфигурации вашего приложения: | ||
|
|
||
| > [!WARNING] | ||
| > Класс yii\redis\predis\PredisConnection поддерживает подключение redis-cluster, но не даёт поддержки интерфейсов компонентов *cache*, *session*, *ActiveRecord*, *mutex* | ||
| ### standalone | ||
| ```php | ||
| return [ | ||
| //.... | ||
| 'components' => [ | ||
| 'redis' => [ | ||
| 'class' => 'yii\redis\predis\PredisConnection', | ||
| 'parameters' => 'tcp://redis:6379', | ||
| 'options' => [ | ||
| 'parameters' => [ | ||
| 'password' => 'secret', // Or NULL | ||
| 'database' => 0, | ||
| 'persistent' => true, | ||
| 'async_connect' => true, | ||
| 'read_write_timeout' => 0.1, | ||
| ], | ||
| ], | ||
| ], | ||
| ] | ||
| ]; | ||
| ``` | ||
| ### sentinel | ||
| ```php | ||
| return [ | ||
| //.... | ||
| 'components' => [ | ||
| 'redis' => [ | ||
| 'class' => 'yii\redis\predis\PredisConnection', | ||
| 'parameters' => [ | ||
| 'tcp://redis-node-1:26379', | ||
| 'tcp://redis-node-2:26379', | ||
| 'tcp://redis-node-3:26379', | ||
| ], | ||
| 'options' => [ | ||
| 'parameters' => [ | ||
| 'password' => 'secret', // Or NULL | ||
| 'database' => 0, | ||
| 'persistent' => true, | ||
| 'async_connect' => true, | ||
| 'read_write_timeout' => 0.1, | ||
| ], | ||
| ], | ||
| ], | ||
| ] | ||
| ]; | ||
| ``` | ||
|
|
||
| > Больше информации можно о конфигурации подключения и опциях можно получить в документации <a href="https://github.com/predis/predis">predis</a>. | ||
| Это обеспечивает базовый доступ к redis-хранилищу через компонент приложения `redis`: | ||
|
|
||
| ```php | ||
| Yii::$app->redis->set('mykey', 'some value'); | ||
| echo Yii::$app->redis->get('mykey'); | ||
| ``` | ||
|
|
||
| Дополнительно | ||
| ----------------- | ||
|
|
||
| * [Использование компонента Cache с predis](topics-predis-cache.md) | ||
| * [Использование компонента Session с predis](topics-predis-session.md) | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.