Redis vs Memcached for WordPress Object Caching: What’s the Difference?

WordPress builds every page from the database. It fetches posts, options, user data, and menu items, then assembles the HTML. On a busy site, the same queries run hundreds of times per minute. An object cache stores those query results in RAM, so WordPress reads them from memory instead of asking MySQL or MariaDB again. Redis vs Memcached WordPress object caching is the choice most VPS owners face at this point. Both tools do the same core job. They differ in what else they can do, how they handle memory, and what survives a server restart.

Neither tool replaces a page cache. A page cache stores finished HTML. An object cache stores the database results WordPress uses to build that HTML. You can run both at once, and most fast WordPress stacks do. If you already run Redis for this job, our guide to installing Redis object cache on a WordPress VPS walks through the setup step by step.

Redis vs Memcached WordPress Object Caching at a Glance

The table below sums up the differences that matter for a WordPress site. The rest of this guide explains each row in plain terms.

Feature Redis Memcached
Data types Strings, hashes, lists, sets, sorted sets, streams Key-value pairs only
Persistence Optional snapshots to disk (RDB) or append-only log (AOF) Memory only, cache empties on restart
Memory limit Set with maxmemory in redis.conf, eviction policy is configurable Set with the -m flag at startup, slab allocator manages the rest
Replication and clustering Built in: replicas, Sentinel, Cluster mode No built-in replication, client-side sharding only
WordPress plugin support Redis Object Cache, W3 Total Cache, LiteSpeed Cache W3 Total Cache, LiteSpeed Cache, Memcached Object Cache
Other common uses Queues, sessions, rate limiting, real-time counters Simple caching only

How Each Tool Stores Data

Memcached stores key-value pairs and nothing else. You give it a key and a value, and it hands the value back. That simplicity is the whole point. There is less to configure, less to misconfigure, and less that can break.

Redis stores the same key-value pairs, plus hashes, lists, sets, and sorted sets. For a WordPress object cache, both plugins store the same kind of data: query results and computed objects under keys. The extra data types in Redis matter only if you plan to use the same server for other jobs later, such as queues, login sessions, or rate limiting.

Persistence: What Survives a Restart

Memcached keeps everything in memory only. Restart the service or reboot the VPS and the cache starts empty. WordPress then rebuilds it as visitors arrive, so the site runs slower for a short while after a restart. That is annoying, not dangerous. No content is lost, because the database still holds the real data.

Redis can write snapshots to disk or log every write to an append-only file. After a restart, it reloads the cache instead of starting cold. For a pure object cache, this is a nice bonus rather than a must-have. It matters more when you also use Redis for sessions or queues, where losing data hurts. Either way, size the cache to fit your RAM budget first. Our guide on how much RAM a WordPress VPS needs helps you work out how much memory you can spare before you install either tool.

Memory Use and Eviction

Both tools evict old data when RAM fills up, and both let you cap how much memory they take. Memcached uses a slab allocator that splits memory into fixed-size classes, which can waste some space when values vary a lot in size. Redis lets you pick an eviction policy, such as allkeys-lru, which drops the least recently used keys first. That control is useful on a small VPS where every megabyte counts.

The practical rule is the same for both: give the cache a fixed cap, watch memory use for a week, and raise the cap only if evictions stay high. An object cache that constantly evicts data barely helps, because WordPress keeps going back to the database anyway. Check memory with free -h and the cache stats with redis-cli INFO or the Memcached stats command before you change any limit.

Setup Effort on a WordPress VPS

Both install with one apt command on Ubuntu: sudo apt install redis-server for Redis, sudo apt install memcached for Memcached. After that, you install a WordPress plugin, point it at localhost, and confirm the connection in the plugin settings. The whole job takes under half an hour on a standard stack. If you are still building that stack, start with our guide to installing WordPress on a LEMP stack with Nginx, PHP, and MariaDB, then add the object cache on top.

One setup detail trips up beginners: the PHP extension. Redis needs php-redis, Memcached needs php-memcached, and the two are not interchangeable. Install the extension that matches the server you installed, restart PHP-FPM, then check the plugin connection page before you assume caching works. A plugin that cannot reach the cache silently falls back to no caching at all.

Redis vs Memcached Comparison: Which One Should You Pick?

Pick Redis if you want one tool that can grow with the site: persistence across restarts, replication if you add a second server later, and the option to run queues or sessions on the same box. Most WordPress hosts that offer object caching pick Redis for these reasons.

Pick Memcached if you want the smallest moving part that does the job: a simple cache, nothing else, with fewer settings to get wrong. On a single small VPS that only runs WordPress, Memcached is enough, and its simplicity is a real advantage when you manage the server yourself.

One more point before you decide: the stack underneath matters as much as the cache. The LAMP vs LEMP comparison for WordPress hosting explains how your choice of web server and database shapes what the cache can do for you. Whichever cache you pick, measure before and after with Query Monitor or your server logs. A persistent object caching WordPress setup should cut repeated database queries on cached pages, and if it does not, the plugin connection is the first thing to check, not the tool itself.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.