Redis and Memcached are caching servers to store the data in Enterprise applications to improve performance.
Difference between Redis and Memcached
Redis | Memcached |
---|---|
In Memory data structure Server | Distributed cache server with high performance |
In Memory cache and persistence storage | Only In Memory Storage |
Key is only strings, values Supports Rich set of data types to store | Supports String key and values only |
Supports listing all keys | Does not support listing all keys |
Master slave Replication is supported for failover | Does not support replication |
Supports Shards for better write access | Does not support scaling |
Supports pub and sub model | Does not support |
Supports LUA scripting to write stored procedure | Does 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.