rhubarbgroup / redis-cache

A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
https://wordpress.org/plugins/redis-cache/
GNU General Public License v3.0
439 stars 150 forks source link

Fix `$salt` when `$group` ends with site id #425

Closed aleks-lynx closed 1 year ago

aleks-lynx commented 1 year ago

Example:

$group = "group1"
$this->blog_prefix = "1"

$salt is "\*:group\*:\*" but should be "\*:group1:\*"
tillkruss commented 1 year ago

@aleks-lynx Thanks! Do you happen to have a snippet I can use to replicate the behaviour locally?

aleks-lynx commented 1 year ago

@tillkruss I called simply wp_cache_flush_group('group1') to reproduce this

aleks-lynx commented 1 year ago

Basically I had a small test for cache implementation and groups -- I created group1, group2, and group3. Then I started to delete them one by one, and then noticed that I can't delete group3 after group1 for some reason :) So the reason was that wp_cache_flush_group('group1') deleted actually all the keys even for group3.

tillkruss commented 1 year ago

Aaaaahh, I see. Nice catch!