Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/andrewklimek/mnml-memcached/archive/refs/heads/main.zipReadme
Mnml Memcached Object Cache for WordPress
A lightweight, custom Memcached backend for WordPress Object Cache with support for batch operations and selective group invalidation.
Features
- Full support for modern batch methods:
get_multiple,set_multiple,add_multiple,delete_multiple - Multisite-aware (blog ID prefixing, global vs site-specific versioning)
- Version-based invalidation for groups and sites (avoids full flushes when possible)
- Local runtime cache layer for single-request performance
- Non-persistent groups support (
$no_mc_groups) - Object cloning to prevent mutation issues
- Sensible Memcached defaults: igbinary serializer, libketama distribution, TCP keepalive, no compression
- Expiration clamping and
WP_INSTALLINGhandling - Persistent connection pooling via named instance
Note: This was developed for personal use and tested primarily on WordPress 5.x–6.x. It may not suit very high-churn plugins (e.g. Formidable Forms) or ultra-low-traffic shared hosting with aggressive PHP worker recycling.
Installation
-
Copy
object-cache.phpto your site'swp-content/directory
(Rename it to exactlyobject-cache.php— WordPress loads this file automatically when present.) -
(Recommended) Define a unique salt in
wp-config.phpfor multi-site or shared Memcached setups:define('WP_CACHE_KEY_SALT', 'your-unique-site-name'); -
Ensure Memcached is running and PHP has the Memcached extension installed. Default server: Unix socket
/var/run/memcached/memcached.sock(override via global $memcached_servers if needed). -
Clear any existing object cache and test (e.g. via Query Monitor or your own stats page).
That's it — no plugin activation required.
Usage Notes
-
Add non-persistent groups if needed (e.g. high-churn or problematic data):
wp_cache_add_non_persistent_groups(['formidable_cache', 'transient']); -
For debugging, the class has a stats() method you can call manually.
Caveats
- Best for sites with moderate traffic and stable/repeated cacheable data.
- May underperform on very low-traffic sites with short-lived PHP processes (frequent reconnects).
- No built-in admin UI or advanced monitoring.