Redis and Memcached are caching servers to store the data in Enterprise applications to improve performance.

Difference between Redis and Memcached

RedisMemcached
In Memory data structure ServerDistributed cache server with high performance
In Memory cache and persistence storageOnly In Memory Storage
Key is only strings, values Supports Rich set of data types to storeSupports String key and values only
Supports listing all keysDoes not support listing all keys
Master slave Replication is supported for failoverDoes not support replication
Supports Shards for better write accessDoes not support scaling
Supports pub and sub modelDoes not support
Supports LUA scripting to write stored procedureDoes not support

When do you choose memcached over redis?

Both are for storing key and value pairs of data.

If you have a use case of a simple application that stores plain key and value pairs of strings and is not required to store the data on disk.

if you have data that has complexdata structure and supports replication and sharding, You can choose Redis.

When do you choose redis over memcached ?

You can choose Redis over memcached in following things

You want to store and persisite the data items even after Redis is restarted.

Expired Elements can be selected and deleted.