Memcached Object Cache
Overview
Memcached object cache stores WordPress objects in Memcached to reduce database load. ZiziCache supports both PHP extensions: memcached (modern) and memcache (legacy).
Requirements
- PHP extension:
memcachedormemcache. - Write access to
wp-content/(forobject-cache.phpdrop-in). - Write access to
wp-config.php(for server list and optional credentials).
Enable in the UI
- Open ZiziCache Memcached.
- Enter servers (one per line):
host:portorunix:///path/to/socket. - Optional: set key salt and SASL credentials (if your Memcached server requires them).
- Click Test Connection, then enable Memcached.
What ZiziCache changes
- Installs
wp-content/object-cache.phpfrom a backend-specific template. - Writes
$memcached_serversand optional constants (key salt, SASL credentials, timeouts) towp-config.php.
Connection testing and safety
- Connection tests are rate-limited (per user, 5minute window).
- Server addresses are validated to reduce SSRF/portscan abuse.
WP-CLI
# Flush object cache (backend-agnostic) wp zizi-cache object-cache-flush
REST API
- GET /wp-json/zizi-cache/v1/memcached-status
- POST /wp-json/zizi-cache/v1/memcached-test
- POST /wp-json/zizi-cache/v1/memcached-flush
- GET /wp-json/zizi-cache/v1/memcached-environment
Backend selection
- If
memcachedis available, it is preferred. - If only
memcacheis available, ZiziCache uses it automatically.
Mutual exclusivity
Only one object cache backend can be active at a time. Enabling Memcached disables Redis and vice versa.