-
Notifications
You must be signed in to change notification settings - Fork 37
improved wording and add cache ttl explanation to woocommerce redis docs #469
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
Open
TimVNL
wants to merge
4
commits into
master
Choose a base branch
from
update-redis-woocommerce
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
14b4feb
improved wording and add cache ttl explanation to woocommerce redis docs
TimVNL e6d8c76
Merge branch 'master' into update-redis-woocommerce
TimVNL bd27481
Update docs/ecommerce-applications/woocommerce/how-to-use-redis-with-…
TimVNL 5cb0dd2
resolved suggestions and add a not about example redis prefix
TimVNL 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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,18 +11,43 @@ myst: | |||||
|
|
||||||
| Remote Dictionary Server (Redis) is an in-memory, persistent, key-value database known as a data structure server. Unlike similar servers, Redis can store and manipulate high-level data types such as lists, maps, sets, and sorted sets. | ||||||
|
|
||||||
| By storing important data in its memory, Redis ensures fast data retrieval, significantly boosting performance and reducing response times. | ||||||
| Because Redis stores data in memory, it can return frequently requested data very quickly. This can improve the performance of WordPress and WooCommerce by reducing database load and speeding up response times. | ||||||
|
|
||||||
| ## Which Plugins Can We Use for Redis in WordPress/WooCommerce? | ||||||
|
|
||||||
| There are several plugins available for Redis. The two most commonly used are [Redis Object Cache](https://wordpress.org/plugins/redis-cache/) and [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/). | ||||||
|
|
||||||
| Due to the complexity of the cache module in "W3 Total Cache" and the possibility that you may already be using other cache plugins, we recommend the "Redis Object Cache" plugin. | ||||||
|
|
||||||
| ## How to set a TTL on Redis keys | ||||||
|
|
||||||
| BBy default, most Redis plugins for WordPress do not set a TTL (time to live) on keys stored in Redis. This means cached keys may remain in memory indefinitely, which can eventually fill up Redis memory and lead to performance issues or downtime. | ||||||
|
|
||||||
| To set a TTL for all keys stored in Redis, add the following lines to your wp-config.php file: | ||||||
|
|
||||||
| ```console | ||||||
| define('WP_REDIS_PREFIX', 'example'); | ||||||
| define('WP_REDIS_MAXTTL', '900'); | ||||||
| define('WP_REDIS_SELECTIVE_FLUSH', true); | ||||||
| ``` | ||||||
| ```{important} | ||||||
| Be sure to change the example prefix to a unique name for your application so Redis keys do not get mixed up when Redis is used by multiple applications on the same Hypernode. | ||||||
| ``` | ||||||
|
|
||||||
| ### Explanation of the wp-config.php options | ||||||
|
|
||||||
| - **WP_REDIS_PREFIX** adds a clear prefix to your Redis keys. This helps prevent key collisions, especially when multiple applications use Redis. | ||||||
| - **WP_REDIS_MAXTTL** sets a maximum lifetime for cached items, in this example 900 seconds. | ||||||
| - **WP_REDIS_SELECTIVE_FLUSH*** ensures that only keys related to this WordPress installation are flushed, instead of clearing the entire Redis database. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## How to Install Redis Object Cache | ||||||
|
|
||||||
| Redis is already active on the server on port `6379`. | ||||||
| Redis is already available on Hypernode and listens on port 6379. | ||||||
|
|
||||||
| Install the Redis Object Cache plugin through the WordPress Dashboard or with Composer. For general plugin installation steps, see the standard WordPress plugin installation documentation. | ||||||
|
|
||||||
| After installing and activating the plugin, go to Settings -> Redis or Network Admin -> Settings -> Redis on Multisite networks | ||||||
|
|
||||||
| Next, install the Redis Object Cache plugin via the WordPress Dashboard or using Composer. For detailed installation instructions, please refer to the standard installation procedure for WordPress plugins. | ||||||
| Enable object caching and verify that the plugin connects to Redis automatically. | ||||||
|
|
||||||
| After installing and activating the plugin, navigate to `WordPress` -> `Settings` -> `Redis` or `Network Admin` -> `Settings` -> `Redis on Multisite networks`. Enable the cache and check if the plugin can connect automatically. | ||||||
| If the plugin does not connect automatically, check whether Redis is reachable on 127.0.0.1:6379 and confirm that your WordPress configuration does not override the default connection settings. | ||||||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.