Thanks.
Somebody claimed on Reddit or something that mine was fastest. I didn’t believe that person, so I did a bunch of tests of other Persistent Object Cache plugins. The ones that used APCu were indeed faster, but broke when used with WP-CLI.
APCu shared memory isn’t shared between web-server worker processes and CLI processes. Each CLI process gets its own copy of the shared memory, which vanishes when it terminates. I guess the term “shared” is aspirational here rather than real.
So in a spirit of friendly competition between open-source community members, I thought to myself, maybe I can make my stuff faster with APCu and still work with WP-CLI.
The two levels of cache (slower SQLite) and (faster APCu) let this work with WP-CLI in the mix. Every write to the cache writes both to APCu and SQLite–it’s a write-through multilevel cache. Whenever WP-CLI-initiated tasks write to the cache, we simply and immediately invalidate the APCu cache. Most installations don’t use enough WP-CLI to make that invalidation into a big performance hit.