Memcached
Part of the Sidecar Services catalog.
What it does
Memcached is an in-memory key-value cache. As a sidecar it backs a WordPress object cache locally, standing in for the managed Memcached a hosting platform provides in production. Add it when a project uses a Memcached-backed object cache and you want the same caching layer on your machine.
How it works
The preset pins memcached:1.6-alpine and listens on container port 11211. Memcached is headless: it gets no browser UI and no host port. WordPress connects to it only over the Docker network. Data is not persisted to a volume, so the cache is cleared when the container is recreated, which matches how a volatile cache behaves.
wdg my-site service add memcachedThere is no UI to open. Confirm it is attached with wdg my-site service list, where it shows as internal only.
How it integrates with the local WordPress container
Adding the sidecar injects these env vars into the WordPress container:
| Variable | Value |
|---|---|
MEMCACHED_HOST | wdg-my-site-memcached (the @HOST token resolved at add-time) |
MEMCACHED_PORT | 11211 |
WordPress reaches Memcached over wdg-network at wdg-my-site-memcached:11211. There is no host port; the connection is container-to-container only.
These env vars are connectivity hints. The project supplies the object-cache drop-in or plugin that consumes them. A drop-in reads the values and registers the server:
$host = getenv( 'MEMCACHED_HOST' ); // wdg-my-site-memcached
$port = (int) getenv( 'MEMCACHED_PORT' ); // 11211
$memcached = new Memcached();
$memcached->addServer( $host, $port );The caching backend (an object-cache.php drop-in or plugin) still has to be installed and enabled. Adding the sidecar wires reachability only.
Add and remove
wdg my-site service add memcached
wdg my-site service remove memcached # no data volume to keep; --purge is a no-op here