What are the fundamental differences between Redis and Memcached as caching solutions?
Short answer
Redis supports a wide variety of rich data structures like hashes, lists, sets, and sorted sets, along with features like persistence, replication, and Pub/Sub, while Memcached is a simpler, purely in memory key value store focused specifically on caching, generally using a…
Advertisement
AModel answer
Redis supports a wide variety of rich data structures like hashes, lists, sets, and sorted sets, along with features like persistence, replication, and Pub/Sub, while Memcached is a simpler, purely in memory key value store focused specifically on caching, generally using a multi threaded architecture that can offer very high throughput for simple string based caching workloads.
Example
-- Redis: rich data types available ZADD leaderboard 100 'player1' -- Memcached: simple key value only set mykey 0 3600 5 value
Real-world example
A team choosing between the two for a simple session caching need with no complex data requirements considers Memcached for its straightforward simplicity, while another team building a leaderboard feature chooses Redis specifically for its native sorted set support.
Likely follow-ups
- Does Memcached support any form of data persistence?
- Which of the two is generally easier to set up for a very basic caching need?
Related topics