I’ve been reading about Couchbase, and I knew it was compatible with Memcached out of the box. One of the features I wanted to start using was Memcached::getMulti
and Memcached::setMulti
. I knew the Memcached WP Object Cache plugin had a get_multi
method, but I didn’t know what it did or how it did it. Turns out, it doesn’t implement Memcached::getMulti
.
When I looked under the hood, I realized that the Memcache extension is loads different than the Memcached extension in PHP. Memcached has the getMulti
method, Memcache does not. So I set out to change this: I have altered the famed Memcached plugin to actually use the Memcached class.
Because I did this, you can now use methods like this:
wp_cache_get_multi( array( array( 'key', 'group' ), array( 'key', '' ), array( 'key', 'group' ), 'key' ) ); wp_cache_set_multi( array( array( 'key', 'data', 'group' ), array( 'key', 'data' ) ) );
Rather than making many calls to grab data, especially related data, you can grab it in one hop.
I’m gonna keep working on the plugin, and drop a line if you install it and have comments / concerns.
The Plugin: Memcached Redux