Docs: Component connections#285
Merged
terabytesoftw merged 9 commits intoyiisoft:masterfrom Mar 3, 2026
Merged
Conversation
Currently does not address the corresponding Predis pages! See craftcms/docs#754 for context.
There was a problem hiding this comment.
Pull request overview
Documentation updates clarifying how Redis connections should be configured (especially per-component nested connections) and expanding the guide to cover mutex usage, in response to post-2.1.0 configuration confusion.
Changes:
- Modernizes Redis component configuration examples (adds required
classkeys for nested connections; uses::classsyntax). - Adds a dedicated “Using the Mutex component” guide page and links it from the docs index.
- Improves wording/grammar and adds operational guidance about isolating components via separate Redis databases (and
Cache::$shareDatabaseimplications).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/guide/usage-commands.md | Clarifies direct command usage and when executeCommand() is needed. |
| docs/guide/topics-session.md | Updates session configuration examples and emphasizes per-component DB separation. |
| docs/guide/topics-predis-session.md | Capitalization/wording cleanup for Predis session docs. |
| docs/guide/topics-predis-cache.md | Updates Predis cache docs (but currently contains a broken class reference). |
| docs/guide/topics-mutex.md | New mutex documentation page and configuration examples. |
| docs/guide/topics-cache.md | Updates cache configuration guidance, adds DB separation + shareDatabase discussion. |
| docs/guide/installation.md | Updates requirements/install/configuration prose and examples. |
| docs/guide/README.md | Updates guide index (adds mutex page; capitalization). |
| README.md | Updates top-level README wording and Redis requirement line. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was copied from the cache page for consistency, but it was… too consistent. :)
…into docs/shared-component-config
AugustMiller
commented
Mar 3, 2026
Contributor
Author
AugustMiller
left a comment
There was a problem hiding this comment.
One legitimate find, one red herring from the clanker.
terabytesoftw
approved these changes
Mar 3, 2026
s1lver
approved these changes
Mar 3, 2026
Member
|
Thks 👍 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a documentation-only PR!
I am on the Craft CMS team, and we got a few reports of configuration issues after updating to version 2.1.0:
yiisoft/yii2-redis2.1.0 craftcms/docs#754As best we could tell, this isn't the result of a bug per se, but rather a difference in how per-component connections need to be defined now that they are not initilized with a concrete class. This used to be an acceptable nested configuration array:
[ 'hostname' => 'localhost', 'port' => 6379, 'password' => 'pass', 'database' => 0, ]Now, a
classkey is required:[ 'class' => yii\redis\Connection::class, 'hostname' => 'localhost', 'port' => 6379, 'password' => 'pass', 'database' => 0, ]Anyone using the default connection (referred to by the component’s ID,
'redis') was not impacted. However, we have recommended using discrete connections for each component (cache, mutex, and sessions) due to the way flushing works when sharing a database.This attempts to describe the tradeoffs involved with a centrally-defined connection (as its own
rediscomponent), versus discrete, nested connections for each component that uses it. It also modernizes some of the config syntax to use the::classqualifier (rather than a string), adds a dedicated mutex page, and cleans up some grammar and cross-references, throughout.Warning
I did not make corresponding changes to the adjacent Predis documentation, or to languages other than English.
Ultimately, it's a bit of an inversion in the recommendations—instead of saying "define your connection once; use it everywhere," the reality is that whether you use Redis in one component or many, you probably want to define the connection at the point of use.