Project

General

Profile

Actions

Bug #13346

closed

Update cache drop-in to support wp_cache_get_multiple()

Added by Boone Gorges about 4 years ago. Updated about 4 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
-
Target version:
Start date:
2020-09-18
Due date:
% Done:

0%

Estimated time:
Deployment actions:

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

Related to CUNY Academic Commons - Bug #13341: Forum reply problemsResolvedRaymond Hoh2020-09-17

Actions
Actions #1

Updated by Boone Gorges about 4 years ago

  • Related to Bug #13341: Forum reply problems added
Actions #2

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().

Actions #3

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.

Actions #4

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.

Actions

Also available in: Atom PDF