pantheon-systems / wp-redis

WordPress Object Cache using Redis.
https://wordpress.org/plugins/wp-redis/
GNU General Public License v2.0
226 stars 68 forks source link

The organization of the keys in Redis like redis cache #282

Closed gurumark closed 4 years ago

gurumark commented 4 years ago

Hello, Thank you for this plugin. I am trying to migrate from redis-cache plugin to WP Redis. However, I noticed that by default all the keys are stored at the root level in Redis. How can I organize them nicely under each database (SALT) name so that it is easier to maintain? Screenshot (12) Thank you.

gurumark commented 4 years ago

I am also searching for a functionality similar to: WP_REDIS_SELECTIVE_FLUSH (default: not set) If set to true, flushing the cache will only delete keys that are prefixed with WP_CACHE_KEY_SALT (instead of emptying the entire Redis database). The selective flush is an atomic O(n) operation. Any help will be greatly appreciated.

danielbachhuber commented 4 years ago

Hi @gurumark:

However, I noticed that by default all the keys are stored at the root level in Redis. How can I organize them nicely under each database (SALT) name so that it is easier to maintain?

I'm not sure, to be honest! I think that's probably outside the scope of this plugin.

I am also searching for a functionality similar to: WP_REDIS_SELECTIVE_FLUSH (default: not set) If set to true, flushing the cache will only delete keys that are prefixed with WP_CACHE_KEY_SALT (instead of emptying the entire Redis database). The selective flush is an atomic O(n) operation.

WP Redis doesn't support this type of selective flush. However, you can connect to a specific Redis database from WordPress, so a comparable alternative would be to use Redis databases for each WordPress installation.