Skip to content

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

Open
ypcs wants to merge 1 commit intomasterfrom
feature/cache-keys
Open

WIP: Set default for cache key if nothing was set#448
ypcs wants to merge 1 commit intomasterfrom
feature/cache-keys

Conversation

@ypcs
Copy link
Copy Markdown
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
@ypcs ypcs force-pushed the feature/cache-keys branch from 6b06bcf to 4539b09 Compare October 8, 2020 10:34
Now we can override default cache key much easier, which allows us to
eg. separate content for different languages when caching it.
@ypcs ypcs force-pushed the feature/cache-keys branch from 4539b09 to 73645e6 Compare October 15, 2020 10:56
@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