Closed erikdemarco closed 2 years ago
@erikdemarco I am actively using this on sites and can confirm it's working.
@timnolte if you see this line: https://github.com/pantheon-systems/wp-redis/blob/e825bc9535753e54e4a69e23b35565d0677e633d/object-cache.php#L1216
I dont see $redis_server['database'] is used anywhere. Even not used in all object-cache.php
Please explain how it know $redis_server['database'] exist?
@erikdemarco if you look right here the database support was originally only half implemented prior to my change. Best to actually look at all of the code and how it works and not just at changed lines of code before throwing around accusations about things not being tested.
@erikdemarco FYI, if you actually read through the code you will also see where this method is used to loop through the keys and establish the connection: https://github.com/pantheon-systems/wp-redis/blob/master/object-cache.php#L1238-L1253
And for your information I just connected to an instance where I have 5 WordPress installs, all variations of the same site, and all connecting to the exact same Redis instance, where a difference database number is provided for each site and there are all using different databases. You'd be wise to actually check your configuration to ensure that you have it configured correctly. If you aren't setting the CACHE_DB
constant then that is your problem.
EDIT: I didnt notice your $keys_methods, Its hard to read at first. Ok solved. Sorry and peace.
There is a commit in #273 made by @timnolte . But it doesnt work.
Do you think just by adding 'database' to $redis_server it will automagically select the database number for us? You need to select it manually after connection, see: https://github.com/phpredis/phpredis#select
something like this:
Maybe we need to do some kind of testing system before deploying the commit, not just blindly accept the commit.
Because of this all my website shared the same database number and causes error to all of them.