Bug #13346
closedUpdate cache drop-in to support wp_cache_get_multiple()
0%
Description
We should update our cache drop-in to support wp_cache_get_multiple(). See https://make.wordpress.org/core/2020/08/11/introduce-wp_cache_get_multiple/. It's possible that Human Made (from whom we borrowed the drop-in) has already done so.
At the same time, we should also fix/update our advanced-post-cache implementation to match. See https://redmine.gc.cuny.edu/issues/13341#note-12
Related issues
Updated by Boone Gorges about 4 years ago
- Related to Bug #13341: Forum reply problems added
Updated by Boone Gorges about 4 years ago
My first pass at this is in the following changesets: https://github.com/cuny-academic-commons/cac/commit/9b394cfaded6a4c4897485bb5aeda848ffc838e5, https://github.com/cuny-academic-commons/cac/commit/9f72271d78851b09af9f057b139ca70664de22c8
It appears that the getMulti()
support in the original HM drop-in is sort of broken. It builds derived keys from the key+group combos passed to the method, and then it uses those derived keys to store the values, so that they're never found. After I figured this out, I now see that it was fixed separately by the HM folks :) https://github.com/humanmade/wordpress-pecl-memcached-object-cache/pull/8/files
I have to step away for the moment, but I'll review in the next few days to see if it's better to merge the upstream changes before implementing wp_cache_get_multiple()
.
Updated by Boone Gorges about 4 years ago
In https://github.com/cuny-academic-commons/cac/commit/a80f4ee51d0ee1687c9b4fceeb180d67bb741e14 I updated our implementation to the "refactor" branch of the HM repo. Neither that branch nor the master branch has been updated in several years, but the refactor branch includes the necessary fixes for getMulti()
, so I went with it. The refactor branch also eliminates a huge amount of unused boilerplate code, making it easier to figure out what's going on in the drop-in.
In https://github.com/cuny-academic-commons/cac/commit/751ea46e56b3177395a98919ffdceaa85e59f17c I re-added support for wp_cache_get_multiple()
. I've run through some tests locally and on cdev (where we run the same instance of Memcached as the production site) and it appears that cache multi-fetches in WP Core are working properly.
Updated by Boone Gorges about 4 years ago
- Status changed from New to Resolved
In https://github.com/cuny-academic-commons/cac/commit/78e4bd750b44cb612efe64515c985eb242e0629e I updated advanced-post-cache to the bleeding edge from the GitHub repo. The main changes here are the new filters for excluding queries for certain post types from the cache.
In https://github.com/cuny-academic-commons/cac/commit/092980b5cd485b01b495118ac459ce06cef76b30 I made the necessary changes so that the plugin uses our new wp_cache_get_multiple()
. I've tested this change and it appears to be working properly.