WP Manifestindependent plugin directory
manifest / performance / mnml-memcached

Mnml Memcached

Memcached backend for the WP Object Cache.

by Andrew Klimek · github.com/andrewklimek/mnml-memcached

0stars
0forks

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.zip

Readme

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_INSTALLING handling
  • 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

  1. Copy object-cache.php to your site's wp-content/ directory
    (Rename it to exactly object-cache.php — WordPress loads this file automatically when present.)

  2. (Recommended) Define a unique salt in wp-config.php for multi-site or shared Memcached setups: define('WP_CACHE_KEY_SALT', 'your-unique-site-name');

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

  4. 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.

Read the full README on GitHub →