Advertisement
Beginner Redis, Redis vs Memcached

Does Memcached support data persistence the way Redis does with RDB and AOF?

Short answer

No, Memcached is purely an in memory cache with no built-in persistence mechanism, meaning all data is permanently lost if the Memcached process restarts or the server reboots, unlike Redis which can optionally persist data to disk, making Redis a better fit when you need your…

Save Redis mock interview
Advertisement
AModel answer
No, Memcached is purely an in memory cache with no built-in persistence mechanism, meaning all data is permanently lost if the Memcached process restarts or the server reboots, unlike Redis which can optionally persist data to disk, making Redis a better fit when you need your cached data to survive a restart.
Example

-- Memcached data is entirely lost on restart -- Redis can optionally survive a restart with RDB or AOF

Real-world example
A team using Memcached purely for ephemeral, easily regenerated cached data is comfortable with the total data loss on restart, while a different team storing important session data specifically chooses Redis for its persistence capabilities.
Likely follow-ups
  • What kinds of data are appropriate to store in a cache with no persistence at all?
  • How quickly can a completely empty cache be repopulated after a restart?
Related topics