Skip to content
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

WIP: Set default for cache key if nothing was set #448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ypcs
Copy link
Contributor

@ypcs ypcs commented Oct 8, 2020

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:

  • install this version to a site
  • ensure with redis-cli keys '*' that keys now value s_ prefix, and if site is multisite or if WPML is installed and enabled, there is also base64-encoded prefix for cache keys

Screenshots

@ypcs ypcs self-assigned this Oct 8, 2020
Now we can override default cache key much easier, which allows us to
eg. separate content for different languages when caching it.
@ypcs ypcs changed the title Set default for cache key if nothing was set WIP: Set default for cache key if nothing was set Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant