seravo-plugin icon indicating copy to clipboard operation
seravo-plugin copied to clipboard

WIP: Set default for cache key if nothing was set

Open ypcs opened this issue 5 years ago • 0 comments

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 avatar Oct 08 '20 10:10 ypcs