Redis vs Memcached
So, I was looking for a crystal clear comparison between these two wonderful cache systems. But I couldn't. I decided to do some research and create a list of top differences between two in a very concise and clear manner so that it helps anyone making a call between using either one for their current application.
-
Memcached is in-memory key value store whereas Redis is in-memory data structures store.
-
Memcached supports only string data type which is ideal for storing read-only data. Redis supports almost all types of data.
-
Redis can also be used as a messaging system such as pubsub. Memcached cannot be used as a pubsub system.
-
Memcached is more memory efficient than Redis. Redis is more memory efficient only after you use hashes.
-
Memcached is volatile store and Redis is non-volatile. Means that data might be lost in Memcached after a reboot of the server/machine. On the other hand, Redis can handle persistent data, and by default Redis syncs data to the disk at least every 2 seconds.
-
Memcached does not support replication, whereas Redis supports master-slave replication.
-
Memcached stores variables in memory and retrieves data directly from server memory. Redis is like a database that resides in memory.
-
Memcached is very good at handling high traffic websites. It can read lot of information at a time and have a great response time. Redis can not handle heavy traffic on read/write.
-
Memcached maximum key length is 250 bytes whereas Redis has a maximum of 2gigs.
You can check out my Medium blog for more such articles.
Cheers!