Closed lesterchan closed 4 years ago
@lesterchan I'm not sure I follow. Can you write some dummy code for me to reproduce this?
After upgrading to WP 5.5 most of the prime caches uses wp_cache_get_multiple()
. Because of the upgrade, it seems that the caches are added but they are not being read. MySQL queries on my home page jump from 2 queries to 40 queries every time.
I am trying to find an easy way to reproduce it, but it is too nested and deep.
So basically, whenever wp_cache_get_multiple()
is being called, the value returned by each key is always false. You can do a var_dump on the output of wp_cache_get_multiple()
Alright, can you open a PR? Or at least some dummy code for me to produce this.
Are you able to reproduce the problem? I don't have enough context for a PR. It seems my "fix" is not working as intended (there are some side effects where it will write empty values to my postmeta).
I also tried WP-Redis as a comparison and it seems to work fine.
@lesterchan: No, I at least need some dummy code to look into it. You logs aren't enough.
@naxvog: Have you had any issues with 5.5 and get_multiple()
?
Let's see if you can reproduce this. 4347 is any post ID.
_prime_post_caches( 4347 );
var_dump(wp_cache_get_multiple([4347], 'posts'));
redis-cache returns
array(1) {
[4347]=>
bool(false)
}
wp-redis returns
array(1) {
--
| [4347]=>
| object(stdClass)#1158 (23) {
.....
Fixed in 4b1e2aee7c6360bc612b97a847fff3c5501f9163.
Thanks @tillkruss! Verified working!
I have been getting cache misses for wp_cache_get_multiple() after upgrading to WP 5.5.
It seems to be returning false all the time as after priming the cache, it doesn't read back from the cache.
Setting the cache
Using get_multiple to read (notice that it returns false for
gamerz_wp:category_relationships:4333
)Might be due to the remaining keys
Line 1371 of object-cache.php
This change works for me.
$cache[ $key ]
will always be set and be false if the cache fails.