WIP: Set default for cache key if nothing was set#448
Open
Conversation
6b06bcf to
4539b09
Compare
Now we can override default cache key much easier, which allows us to eg. separate content for different languages when caching it.
4539b09 to
73645e6
Compare
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.
Now we can override default cache key much easier, which allows us to
eg. separate content for different languages when caching it.
What are the main changes in this PR?
When plugin is loaded, it generates default value for
WP_CACHE_KEY_SALT, if there is none defined. User is able to override our defaults (we set WPML language and multisite site ID if we can determine values for those).Why are we doing this? Any context or related work?
This fixes multiple cases where customer has encountered issues when using object-cache, as OC has eg. cached multiple languages with same keys, thus showing wrong content to wrong users.
Where should a reviewer start?
Manual testing steps?
So far what I've tried to do when testing this:
redis-cli keys '*'that keys now values_prefix, and if site is multisite or if WPML is installed and enabled, there is also base64-encoded prefix for cache keysScreenshots