From be00aab315a9ff3b6d60804b1b6bb70d284b25a9 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Thu, 16 May 2024 08:49:59 -0300 Subject: [PATCH] Fix docs (#52) Co-authored-by: Sergei Predvoditelev --- CHANGELOG.md | 53 ++++++---------------- LICENSE.md | 6 +-- README.md | 73 ++++++++++++++++++++++-------- composer.json | 17 +++++-- docs/guide/en/README.md | 25 +++------- docs/guide/en/installation.md | 41 ----------------- docs/guide/en/topics-cache.md | 15 +++--- docs/guide/en/topics-session.md | 9 ++-- docs/guide/en/usage-ar.md | 11 ++--- docs/guide/en/usage-commands.md | 7 ++- docs/guide/ja/installation.md | 4 +- docs/guide/pt-BR/README.md | 25 +++------- docs/guide/pt-BR/installation.md | 41 ----------------- docs/guide/pt-BR/topics-cache.md | 17 ++++--- docs/guide/pt-BR/topics-session.md | 11 ++--- docs/guide/pt-BR/usage-ar.md | 33 +++++++------- docs/guide/pt-BR/usage-commands.md | 13 +++--- docs/guide/ru/installation.md | 4 +- docs/guide/zh-CN/installation.md | 4 +- docs/internals.md | 9 ---- 20 files changed, 159 insertions(+), 259 deletions(-) delete mode 100644 docs/guide/en/installation.md delete mode 100644 docs/guide/pt-BR/installation.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 79d840b6f..7d139345b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,16 @@ -Yii DB Redis extension Change Log -========================================== +# Yii DB Redis extension Change Log -2.0.9 under development ------------------------ +## 2.0.9 under development - no changes in this release. - -2.0.8 March 20, 2018 --------------------- +## 2.0.8 March 20, 2018 - Bug #141: Calling ActiveQuery::indexBy() had no effect since Yii 2.0.14 (cebe) - Bug: (CVE-2018-8073): Fix possible remote code execution when improperly filtered user input is passed to `ActiveRecord::findOne()` and `::findAll()` (cebe) - Enh #66: Cache component can be configured to read / get from replicas (ryusoft) - -2.0.7 December 11, 2017 ------------------------ +## 2.0.7 December 11, 2017 - Bug #114: Fixed ActiveQuery `not between` and `not` conditions which where not working correctly (cebe, ak1987) - Bug #123: Fixed ActiveQuery to work with negative limit values, which are used in ActiveDataProvider for the count query (cebe) @@ -25,9 +19,7 @@ Yii DB Redis extension Change Log - Enh #106: Improved handling of connection errors and introduced `yii\redis\SocketException` for these (cebe) - Chg #127: Added PHP 7.2 compatibility (brandonkelly) - -2.0.6 April 05, 2017 --------------------- +## 2.0.6 April 05, 2017 - Bug #44: Remove quotes from numeric parts of composite key to avoid problem with different hashes for the same record (uniserpl) - Bug #67: Fixed regression from 2.0.5, reconnecting a closed connection fails (cebe) @@ -40,9 +32,7 @@ Yii DB Redis extension Change Log - Enh #103: Added missing commands and `@method` documentation for redis commands (cebe) - Enh: Optimized find by PK for relational queries and IN condition (cebe, andruha) - -2.0.5 March 17, 2016 --------------------- +## 2.0.5 March 17, 2016 - Bug #22: Fixed string escaping issue in LuaScriptBuilder (vistart) - Bug #37: Fixed detection of open socket (mirocow) @@ -51,49 +41,35 @@ Yii DB Redis extension Change Log - Chg #14: Added missing `BLPOP` command to `$redisCommands` (samdark) - Chg #61: Added missing `GEO*` commands to `$redisCommands` (leadermt) - -2.0.4 May 10, 2015 ------------------- +## 2.0.4 May 10, 2015 - Enh #8: Auto increment value was not updated when a primary key was explicitly set (cebe, andruha) - -2.0.3 March 01, 2015 --------------------- +## 2.0.3 March 01, 2015 - no changes in this release. - -2.0.2 January 11, 2015 ----------------------- +## 2.0.2 January 11, 2015 - Bug #6547: Fixed redis connection to deal with large data in combination with `mget()` (pyurin) - -2.0.1 December 07, 2014 ------------------------ +## 2.0.1 December 07, 2014 - Bug #4745: value of simple string returns was ignored by redis client and `true` is returned instead, now only `OK` will result in a `true` while all other values are returned as is (cebe) - Enh #3714: Added support for connecting to redis server using a unix socket (savvot, robregonm) - -2.0.0 October 12, 2014 ----------------------- +## 2.0.0 October 12, 2014 - no changes in this release. - -2.0.0-rc September 27, 2014 ---------------------------- +## 2.0.0-rc September 27, 2014 - Bug #1311: Fixed storage and finding of `null` and boolean values (samdark, cebe) - Enh #3520: Added `unlinkAll()`-method to active record to remove all records of a model relation (NmDimas, samdark, cebe) - Enh #4048: Added `init` event to `ActiveQuery` classes (qiangxue) - Enh #4086: changedAttributes of afterSave Event now contain old values (dizews) - -2.0.0-beta April 13, 2014 -------------------------- +## 2.0.0-beta April 13, 2014 - Bug #1993: afterFind event in AR is now called after relations have been populated (cebe, creocoder) - Enh #1773: keyPrefix property of Session and Cache is not restricted to alnum characters anymore (cebe) @@ -104,7 +80,6 @@ Yii DB Redis extension Change Log All relational queries are now directly served by `ActiveQuery` allowing to use custom scopes in relations (cebe) -2.0.0-alpha, December 1, 2013 ------------------------------ +## 2.0.0-alpha, December 1, 2013 - Initial release. diff --git a/LICENSE.md b/LICENSE.md index 6a920d605..c48bcea79 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -5,13 +5,13 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of Yii Software nor the names of its + * Neither the name of Yii Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/README.md b/README.md index 07558799c..1012210d1 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,44 @@

- - + + Yii + + + Redis

Yii DBAL Redis connection


-This extension provides the [redis](https://redis.io/) connection support for the [Yii framework](https://www.yiiframework.com). - [![Latest Stable Version](https://poser.pugx.org/yiisoft/db-redis/v/stable.png)](https://packagist.org/packages/yiisoft/db-redis) [![Total Downloads](https://poser.pugx.org/yiisoft/db-redis/downloads.png)](https://packagist.org/packages/yiisoft/db-redis) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yiisoft/db-redis/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/db-redis/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/db-redis/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/db-redis/?branch=master) +This extension provides the [redis](https://redis.io/) connection support for the [Yii framework](https://www.yiiframework.com). + +It includes a `Cache` and `Session` storage handler and implements the `ActiveRecord` pattern that allows +you to store active records in redis. + ## Support version -| PHP | Redis Version | CI-Actions -|:----:|:------------------------:|:---:| +| PHP | Redis Version | CI-Actions | +|-----|---------------|------------| |**7.4 - 8.0**| **4 - 6**|[![Build status](https://github.com/yiisoft/db-redis/workflows/build/badge.svg)](https://github.com/yiisoft/db-redis/actions?query=workflow%3Abuild) [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fdb-redis%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/db-redis/master) [![static analysis](https://github.com/yiisoft/db-redis/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/db-redis/actions?query=workflow%3A%22static+analysis%22) [![type-coverage](https://shepherd.dev/github/yiisoft/db-redis/coverage.svg)](https://shepherd.dev/github/yiisoft/db-redis) +## Requirements + +- Redis version 2.6.12 or higher. +- `Filter` PHP extension. + ## Installation -The package could be installed via composer: +The package could be installed with [Composer](https://getcomposer.org): ```shell composer require yiisoft/db-redis ``` -## Configuration +## General usage Using `yiisoft/composer-config-plugin` automatically get the settings of `EventDispatcherInterface::class` and `LoggerInterface::class`. @@ -63,17 +74,48 @@ return [ ]; ``` +## Configuring application + +To use this extension, you have to configure the `Yiisoft\Db\Redis\Connection|Connection` class in your application configuration: + +```php +return [ + //.... + 'components' => [ + 'redis' => [ + 'class' => 'Yiisoft\Db\Redis\Connection', + 'hostname' => 'localhost', + 'port' => 6379, + 'database' => 0, + ], + ] +]; +``` + +This provides the basic access to redis storage via the `redis` application component: + +```php +Yii::$app->redis->set('mykey', 'some value'); +echo Yii::$app->redis->get('mykey'); +``` + +See [Yiisoft\Db\Redis\Connection] for a full list of available methods. + ## Documentation -- [English](docs/guide/en/README.md) -- [Português - Brasil](docs/guide/pt-BR/readme.md) +- Guide: [English](docs/guide/en/README.md), [日本語](docs/guide/ja/README.md), [Português - Brasil](docs/guide/pt-BR/README.md), [Русский](docs/guide/ru/README.md), [中国人](docs/guide/zh-CN/README.md) - [Internals](docs/internals.md) -## Support - If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that. You may also check out other [Yii Community Resources](https://www.yiiframework.com/community). +## License + +The Yii DBAL Redis connection is free software. It is released under the terms of the BSD License. +Please see [`LICENSE`](./LICENSE.md) for more information. + +Maintained by [Yii Software](https://www.yiiframework.com/). + ## Support the project [![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective&logoColor=7eadf1&labelColor=555555)](https://opencollective.com/yiisoft) @@ -85,10 +127,3 @@ You may also check out other [Yii Community Resources](https://www.yiiframework. [![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat&logo=telegram)](https://t.me/yii3en) [![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat&logo=facebook&logoColor=ffffff)](https://www.facebook.com/groups/yiitalk) [![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack)](https://yiiframework.com/go/slack) - -## License - -The Yii DBAL Redis connection is free software. It is released under the terms of the BSD License. -Please see [`LICENSE`](./LICENSE.md) for more information. - -Maintained by [Yii Software](https://www.yiiframework.com/). diff --git a/composer.json b/composer.json index 79afa92e0..1e0b6fb34 100644 --- a/composer.json +++ b/composer.json @@ -11,12 +11,23 @@ "type": "library", "license": "BSD-3-Clause", "support": { - "issues": "https://github.com/yiisoft/db-redis/issues", + "issues": "https://github.com/yiisoft/db-redis/issues?state=open", + "source": "https://github.com/yiisoft/db-redis", "forum": "https://www.yiiframework.com/forum/", "wiki": "https://www.yiiframework.com/wiki/", "irc": "ircs://irc.libera.chat:6697/yii", - "source": "https://github.com/yiisoft/db-redis" + "chat": "https://t.me/yii3en" }, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/yiisoft" + }, + { + "type": "github", + "url": "https://github.com/sponsors/yiisoft" + } + ], "minimum-stability": "dev", "prefer-stable": true, "require": { @@ -57,4 +68,4 @@ "infection/extension-installer": true } } -} \ No newline at end of file +} diff --git a/docs/guide/en/README.md b/docs/guide/en/README.md index 7983957ae..893fd214d 100644 --- a/docs/guide/en/README.md +++ b/docs/guide/en/README.md @@ -1,22 +1,11 @@ -# Yii Framework Redis Cache, Session and ActiveRecord extension +# Yii Database Redis Cache, Session and ActiveRecord extension -This extension provides the [redis](https://redis.io/) key-value store support for the Yii2 framework. -It includes a `Cache` and `Session` storage handler and implements the `ActiveRecord` pattern that allows -you to store active records in redis. +## General usage -Getting Started ---------------- +- [Using the ActiveRecord](usage-ar.md) +- [Using commands directly](usage-commands.md) -* [Installation](installation.md) +## Additional topics -Usage ------ - -* [Using the ActiveRecord](usage-ar.md) -* [Using commands directly](usage-commands.md) - -Additional topics ------------------ - -* [Using the Cache component](topics-cache.md) -* [Using the Session component](topics-session.md) +- [Using the Cache component](topics-cache.md) +- [Using the Session component](topics-session.md) diff --git a/docs/guide/en/installation.md b/docs/guide/en/installation.md deleted file mode 100644 index 97a158cfe..000000000 --- a/docs/guide/en/installation.md +++ /dev/null @@ -1,41 +0,0 @@ -Installation -============ - -## Requirements - -At least redis version 2.6.12 is required for all components to work properly. - -## Getting Composer package - -The preferred way to install this extension is through [composer](https://getcomposer.org/download/). - -```shell -composer require --prefer-dist yiisoft/db-redis -``` - -## Configuring application - -To use this extension, you have to configure the [[Yiisoft\Db\Redis\Connection|Connection]] class in your application configuration: - -```php -return [ - //.... - 'components' => [ - 'redis' => [ - 'class' => 'Yiisoft\Db\Redis\Connection', - 'hostname' => 'localhost', - 'port' => 6379, - 'database' => 0, - ], - ] -]; -``` - -This provides the basic access to redis storage via the `redis` application component: - -```php -Yii::$app->redis->set('mykey', 'some value'); -echo Yii::$app->redis->get('mykey'); -``` - -See [[Yiisoft\Db\Redis\Connection]] for a full list of available methods. diff --git a/docs/guide/en/topics-cache.md b/docs/guide/en/topics-cache.md index 647d825c9..867c1ddf5 100644 --- a/docs/guide/en/topics-cache.md +++ b/docs/guide/en/topics-cache.md @@ -1,8 +1,7 @@ -Using the Cache component -========================= +# Using the Cache component -To use the `Cache` component, in addition to configuring the connection as described in the [Installation](installation.md) section, -you also have to configure the `cache` component to be [[Yiisoft\Db\Redis\Cache]]: +To use the [Caching Library](https://github.com/yiisoft/cache-redis), in addition to configuring the connection as described in the [Configuring application](../../../README.md#Configuring-application) section, +you also have to configure the `cache` component to be `Yiisoft\Db\Redis\Cache`: ```php return [ @@ -16,7 +15,7 @@ return [ ]; ``` -If you only use the redis cache (i.e., not using its ActiveRecord or Session), you can also configure the parameters of the connection within the +If you only use the redis cache (i.e., not using its [ActiveRecord](https://github.com/yiisoft/active-record) or [Session](https://github.com/yiisoft/session)), you can also configure the parameters of the connection within the cache component (no connection application component needs to be configured in this case): ```php @@ -36,8 +35,8 @@ return [ ]; ``` -The cache provides all methods of the [[yii\caching\CacheInterface]]. If you want to access redis specific methods that are not -included in the interface, you can use them via [[Yiisoft\Db\Redis\Cache::$redis]], which is an instance of [[Yiisoft\Db\Redis\Connection]]: +The cache provides all methods of the `yii\caching\CacheInterface`. If you want to access redis specific methods that are not +included in the interface, you can use them via `Yiisoft\Db\Redis\Cache::$redis`, which is an instance of`Yiisoft\Db\Redis\Connection`: ```php Yii::$app->cache->redis->hset('mykey', 'somefield', 'somevalue'); @@ -45,4 +44,4 @@ Yii::$app->cache->redis->hget('mykey', 'somefield'); ... ``` -See [[Yiisoft\Db\Redis\Connection]] for a full list of available methods. +See `Yiisoft\Db\Redis\Connection` for a full list of available methods. diff --git a/docs/guide/en/topics-session.md b/docs/guide/en/topics-session.md index a90b5f4e3..676c44ece 100644 --- a/docs/guide/en/topics-session.md +++ b/docs/guide/en/topics-session.md @@ -1,8 +1,7 @@ -Using the Session component -=========================== +# Using the Session component -To use the `Session` component, in addition to configuring the connection as described in the [Installation](installation.md) section, -you also have to configure the `session` component to be [[Yiisoft\Db\Redis\Session]]: +To use the [Session](https://github.com/yiisoft/session) component, in addition to configuring the connection as described in the [Configuring application](../../../README.md#Configuring-application) section, +you also have to configure the `session` component to be `Yiisoft\Db\Redis\Session`: ```php return [ @@ -16,7 +15,7 @@ return [ ]; ``` -If you only use redis session (i.e., not using its ActiveRecord or Cache), you can also configure the parameters of the connection within the +If you only use redis session (i.e., not using its [ActiveRecord](https://github.com/yiisoft/active-record) or [Cache](https://github.com/yiisoft/cache-redis)), you can also configure the parameters of the connection within the session component (no connection application component needs to be configured in this case): ```php diff --git a/docs/guide/en/usage-ar.md b/docs/guide/en/usage-ar.md index d0d9e2cce..6bc0362a3 100644 --- a/docs/guide/en/usage-ar.md +++ b/docs/guide/en/usage-ar.md @@ -1,11 +1,10 @@ -Using the ActiveRecord -====================== +# Using the ActiveRecord -For general information on how to use yii's ActiveRecord please refer to the [guide](https://www.yiiframework.com/doc/guide/2.0/en/db-active-record). +For general information on how to use Yii ActiveRecord please refer to the [guide](https://www.yiiframework.com/doc/guide/2.0/en/db-active-record). -For defining a redis ActiveRecord class your record class needs to extend from [[Yiisoft\Db\Redis\ActiveRecord]] and +For defining a redis ActiveRecord class your record class needs to extend from `Yiisoft\Db\Redis\ActiveRecord` and implement at least the `attributes()` method to define the attributes of the record. -A primary key can be defined via [[Yiisoft\Db\Redis\ActiveRecord::primaryKey()]] which defaults to `id` if not specified. +A primary key can be defined via `Yiisoft\Db\Redis\ActiveRecord::primaryKey()` which defaults to `id` if not specified. The primaryKey needs to be part of the attributes so make sure you have an `id` attribute defined if you do not specify your own primary key. @@ -48,7 +47,7 @@ It supports the same interface and features except the following limitations: `where()`, `limit()`, `offset()`, `orderBy()` and `indexBy()`. - `via`-relations can not be defined via a table as there are not tables in redis. You can only define relations via other records. -It is also possible to define relations from redis ActiveRecords to normal ActiveRecord classes and vice versa. +It is also possible to define relations from redis ActiveRecords to normal [ActiveRecord](https://github.com/yiisoft/active-record) classes and vice versa. Usage example: diff --git a/docs/guide/en/usage-commands.md b/docs/guide/en/usage-commands.md index e191fbad6..4ff96225a 100644 --- a/docs/guide/en/usage-commands.md +++ b/docs/guide/en/usage-commands.md @@ -1,8 +1,7 @@ -Using commands directly -======================= +# Using commands directly Redis has lots of useful commands which could be used directly from connection. After configuring application as -shown in [installation](installation.md), connection could be obtained like the following: +shown in [Configuring application](../../../README.md#Configuring-application) section, connection could be obtained like the following: ```php $redis = Yii::$app->redis; @@ -20,4 +19,4 @@ There are shortcuts available for each command supported so insted of the above $result = $redis->hmset('test_collection', 'key1', 'val1', 'key2', 'val2'); ``` -For a list of available commands and their parameters see . +For a list of available commands and their parameters see [redis Commands](https://redis.io/commands). diff --git a/docs/guide/ja/installation.md b/docs/guide/ja/installation.md index 087f95f47..8775d8397 100644 --- a/docs/guide/ja/installation.md +++ b/docs/guide/ja/installation.md @@ -7,12 +7,12 @@ ## Composer パッケージを取得する -このエクステンションをインストールするのに推奨される方法は [composer](https://getcomposer.org/download/) によるものです。 +このエクステンションをインストールするのに推奨される方法は [Composer](https://getcomposer.org): によるものです。 下記のコマンドを実行してください。 ``` -php composer.phar require --prefer-dist yiisoft/db-redis +composer require yiisoft/db-redis ``` または、あなたの `composer.json` ファイルの `require` セクションに、 diff --git a/docs/guide/pt-BR/README.md b/docs/guide/pt-BR/README.md index 7983957ae..545d8ceab 100644 --- a/docs/guide/pt-BR/README.md +++ b/docs/guide/pt-BR/README.md @@ -1,22 +1,11 @@ -# Yii Framework Redis Cache, Session and ActiveRecord extension +# Yii Database Redis Cache, Session and ActiveRecord extension -This extension provides the [redis](https://redis.io/) key-value store support for the Yii2 framework. -It includes a `Cache` and `Session` storage handler and implements the `ActiveRecord` pattern that allows -you to store active records in redis. +## Uso geral -Getting Started ---------------- +- [Usando ActiveRecord](usage-ar.md) +- [Usando comandos diretamente](usage-commands.md) -* [Installation](installation.md) +## Tópicos adicionais -Usage ------ - -* [Using the ActiveRecord](usage-ar.md) -* [Using commands directly](usage-commands.md) - -Additional topics ------------------ - -* [Using the Cache component](topics-cache.md) -* [Using the Session component](topics-session.md) +- [Usando o componente Cache](topics-cache.md) +- [Usando o componente Session](topics-session.md) diff --git a/docs/guide/pt-BR/installation.md b/docs/guide/pt-BR/installation.md deleted file mode 100644 index 97a158cfe..000000000 --- a/docs/guide/pt-BR/installation.md +++ /dev/null @@ -1,41 +0,0 @@ -Installation -============ - -## Requirements - -At least redis version 2.6.12 is required for all components to work properly. - -## Getting Composer package - -The preferred way to install this extension is through [composer](https://getcomposer.org/download/). - -```shell -composer require --prefer-dist yiisoft/db-redis -``` - -## Configuring application - -To use this extension, you have to configure the [[Yiisoft\Db\Redis\Connection|Connection]] class in your application configuration: - -```php -return [ - //.... - 'components' => [ - 'redis' => [ - 'class' => 'Yiisoft\Db\Redis\Connection', - 'hostname' => 'localhost', - 'port' => 6379, - 'database' => 0, - ], - ] -]; -``` - -This provides the basic access to redis storage via the `redis` application component: - -```php -Yii::$app->redis->set('mykey', 'some value'); -echo Yii::$app->redis->get('mykey'); -``` - -See [[Yiisoft\Db\Redis\Connection]] for a full list of available methods. diff --git a/docs/guide/pt-BR/topics-cache.md b/docs/guide/pt-BR/topics-cache.md index 647d825c9..7b1f7270e 100644 --- a/docs/guide/pt-BR/topics-cache.md +++ b/docs/guide/pt-BR/topics-cache.md @@ -1,8 +1,7 @@ -Using the Cache component -========================= +# Usando o componente Cache -To use the `Cache` component, in addition to configuring the connection as described in the [Installation](installation.md) section, -you also have to configure the `cache` component to be [[Yiisoft\Db\Redis\Cache]]: +Para utilizar a [Caching Library](https://github.com/yiisoft/cache-redis), além de configurar a conexão conforme descrito na seção [Configurando o aplicativo](../../../README.md#Configuring-application), +você também deve configurar o componente `cache` como `Yiisoft\Db\Redis\Cache`: ```php return [ @@ -16,8 +15,8 @@ return [ ]; ``` -If you only use the redis cache (i.e., not using its ActiveRecord or Session), you can also configure the parameters of the connection within the -cache component (no connection application component needs to be configured in this case): +Se você usar apenas o cache redis (ou seja, não usar seu [ActiveRecord](https://github.com/yiisoft/active-record) ou [Session](https://github.com/yiisoft/session)), você também pode configurar os parâmetros da conexão dentro do +componente de cache (nenhum componente de aplicativo de conexão precisa ser configurado neste caso): ```php return [ @@ -36,8 +35,8 @@ return [ ]; ``` -The cache provides all methods of the [[yii\caching\CacheInterface]]. If you want to access redis specific methods that are not -included in the interface, you can use them via [[Yiisoft\Db\Redis\Cache::$redis]], which is an instance of [[Yiisoft\Db\Redis\Connection]]: +O cache fornece todos os métodos de `yii\caching\CacheInterface`. Se você deseja acessar métodos específicos do Redis que não estão +incluídos na interface, você pode usá-los via `Yiisoft\Db\Redis\Cache::$redis`, que é uma instância de`Yiisoft\Db\Redis\Connection`: ```php Yii::$app->cache->redis->hset('mykey', 'somefield', 'somevalue'); @@ -45,4 +44,4 @@ Yii::$app->cache->redis->hget('mykey', 'somefield'); ... ``` -See [[Yiisoft\Db\Redis\Connection]] for a full list of available methods. +Veja `Yiisoft\Db\Redis\Connection` para uma lista completa dos métodos disponíveis. diff --git a/docs/guide/pt-BR/topics-session.md b/docs/guide/pt-BR/topics-session.md index a90b5f4e3..d5469b6f9 100644 --- a/docs/guide/pt-BR/topics-session.md +++ b/docs/guide/pt-BR/topics-session.md @@ -1,8 +1,7 @@ -Using the Session component -=========================== +# Usando o componente Session -To use the `Session` component, in addition to configuring the connection as described in the [Installation](installation.md) section, -you also have to configure the `session` component to be [[Yiisoft\Db\Redis\Session]]: +Para utilizar o componente [Session](https://github.com/yiisoft/session), além de configurar a conexão conforme descrito na seção [Configurando o aplicativo](../../../README.md#Configuring-application), +você também deve configurar o componente `session` como `Yiisoft\Db\Redis\Session`: ```php return [ @@ -16,8 +15,8 @@ return [ ]; ``` -If you only use redis session (i.e., not using its ActiveRecord or Cache), you can also configure the parameters of the connection within the -session component (no connection application component needs to be configured in this case): +Se você usar apenas sessão redis (ou seja, não usar [ActiveRecord](https://github.com/yiisoft/active-record) ou [Cache](https://github.com/yiisoft/cache-redis)), você também pode configurar os parâmetros da conexão dentro do +componente de sessão (nenhum componente de aplicativo de conexão precisa ser configurado neste caso): ```php return [ diff --git a/docs/guide/pt-BR/usage-ar.md b/docs/guide/pt-BR/usage-ar.md index d0d9e2cce..18c202bde 100644 --- a/docs/guide/pt-BR/usage-ar.md +++ b/docs/guide/pt-BR/usage-ar.md @@ -1,15 +1,14 @@ -Using the ActiveRecord -====================== +# Usando ActiveRecord -For general information on how to use yii's ActiveRecord please refer to the [guide](https://www.yiiframework.com/doc/guide/2.0/en/db-active-record). +Para informações gerais sobre como usar o Yii ActiveRecord, consulte o [guia](https://www.yiiframework.com/doc/guide/2.0/en/db-active-record). -For defining a redis ActiveRecord class your record class needs to extend from [[Yiisoft\Db\Redis\ActiveRecord]] and -implement at least the `attributes()` method to define the attributes of the record. -A primary key can be defined via [[Yiisoft\Db\Redis\ActiveRecord::primaryKey()]] which defaults to `id` if not specified. -The primaryKey needs to be part of the attributes so make sure you have an `id` attribute defined if you do -not specify your own primary key. +Para definir uma classe Redis ActiveRecord, sua classe de registro precisa se estender de `Yiisoft\Db\Redis\ActiveRecord` e +implemente pelo menos o método `attributes()` para definir os atributos do registro. +Uma chave primária pode ser definida via `Yiisoft\Db\Redis\ActiveRecord::primaryKey()` cujo padrão é `id` se não for especificado. +O PrimaryKey precisa fazer parte dos atributos, então certifique-se de ter um atributo `id` definido se você fizer isso +não especifique sua própria chave primária. -The following is an example model called `Customer`: +A seguir está um modelo de exemplo chamado `Customer`: ```php class Customer extends \Yiisoft\Db\Redis\ActiveRecord @@ -40,17 +39,17 @@ class Customer extends \Yiisoft\Db\Redis\ActiveRecord } ``` -The general usage of redis ActiveRecord is very similar to the database ActiveRecord as described in the -[guide](https://www.yiiframework.com/doc/guide/2.0/en/db-active-record). -It supports the same interface and features except the following limitations: +O uso geral do redis ActiveRecord é muito semelhante ao banco de dados ActiveRecord conforme descrito no +[guia](https://www.yiiframework.com/doc/guide/2.0/en/db-active-record). +Ele suporta a mesma interface e recursos, exceto as seguintes limitações: -- As redis does not support SQL the query API is limited to the following methods: - `where()`, `limit()`, `offset()`, `orderBy()` and `indexBy()`. -- `via`-relations can not be defined via a table as there are not tables in redis. You can only define relations via other records. +- Como redis não suporta SQL, a API de consulta está limitada aos seguintes métodos: + `where()`, `limit()`, `offset()`, `orderBy()` e `indexBy()`. +- As relações `via` não podem ser definidas através de uma tabela, pois não existem tabelas no redis. Você só pode definir relações através de outros registros. -It is also possible to define relations from redis ActiveRecords to normal ActiveRecord classes and vice versa. +Também é possível definir relações de ActiveRecords redis para classes [ActiveRecord](https://github.com/yiisoft/active-record) normais e vice-versa. -Usage example: +Exemplo de uso: ```php $customer = new Customer(); diff --git a/docs/guide/pt-BR/usage-commands.md b/docs/guide/pt-BR/usage-commands.md index e191fbad6..92639d4ff 100644 --- a/docs/guide/pt-BR/usage-commands.md +++ b/docs/guide/pt-BR/usage-commands.md @@ -1,23 +1,22 @@ -Using commands directly -======================= +# Usando comandos diretamente -Redis has lots of useful commands which could be used directly from connection. After configuring application as -shown in [installation](installation.md), connection could be obtained like the following: +Redis tem muitos comandos úteis que podem ser usados diretamente pela conexão. Depois de configurar o aplicativo como +mostrado na seção [Configurando o aplicativo](../../../README.md#Configuring-application), a conexão pode ser obtida da seguinte forma: ```php $redis = Yii::$app->redis; ``` -After it's done one can execute commands. The most generic way to do it is using `executeCommand` method: +Depois de feito, pode-se executar comandos. A maneira mais genérica de fazer isso é usando o método `executeCommand`: ```php $result = $redis->executeCommand('hmset', ['test_collection', 'key1', 'val1', 'key2', 'val2']); ``` -There are shortcuts available for each command supported so insted of the above it can be used as follows: +Existem atalhos disponíveis para cada comando suportado, portanto, em vez do acima, ele pode ser usado da seguinte maneira: ```php $result = $redis->hmset('test_collection', 'key1', 'val1', 'key2', 'val2'); ``` -For a list of available commands and their parameters see . +Para obter uma lista de comandos disponíveis e seus parâmetros, consulte [Comandos redis](https://redis.io/commands). diff --git a/docs/guide/ru/installation.md b/docs/guide/ru/installation.md index bbe80fe50..d9c9c6dcf 100644 --- a/docs/guide/ru/installation.md +++ b/docs/guide/ru/installation.md @@ -7,12 +7,12 @@ ## Установка расширения -Предпочтительным способом установки этого расширения является [Composer](https://getcomposer.org/download/). +Предпочтительным способом установки этого расширения является [Composer](https://getcomposer.org): Для этого запустите команду ``` -php composer.phar require --prefer-dist yiisoft/db-redis +composer require yiisoft/db-redis ``` или добавьте diff --git a/docs/guide/zh-CN/installation.md b/docs/guide/zh-CN/installation.md index b651ce73e..a48931e25 100644 --- a/docs/guide/zh-CN/installation.md +++ b/docs/guide/zh-CN/installation.md @@ -7,12 +7,12 @@ redis 2.6.12 版本是所有部件正常工作所必需的。 ## 获取 Composer 安装包 -安装此扩展的首选方式是通过 [composer](https://getcomposer.org/download/)。 +安装此扩展的首选方式是通过 [Composer](https://getcomposer.org):。 可以运行 ``` -php composer.phar require --prefer-dist yiisoft/db-redis +composer require yiisoft/db-redis ``` 或者添加 diff --git a/docs/internals.md b/docs/internals.md index 3ca962dad..b37b5b8dd 100644 --- a/docs/internals.md +++ b/docs/internals.md @@ -24,12 +24,3 @@ The code is statically analyzed with [Psalm](https://psalm.dev/). To run static ```shell ./vendor/bin/psalm ``` - -## Rector - -Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or -use either newest or any specific version of PHP: - -```shell -./vendor/bin/rector -```