Summary one:
Memcache official definition
Free & Open Source, High-performance, distributed memory object caching system, generic into nature, but intended for us E in speeding up dynamic Web applications by alleviating database load.
Redis official definition
Redis is an open source, BSD licensed, Advanced Key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
Same copyright
They are all used by the BSD protocol, the project can be used for commercial users, do not have to publish two modified code, you can modify the source code.
Data type
Redis data type rich, support set Liset and other types
Memcache supports simple data types that require clients to handle complex objects themselves
Persistence of
Redis support data Landing persistent storage
Memcache does not support data persistent storage
Distributed storage
Redis Support Master-slave Replication mode
Memcache can use consistent hash to do distributed
Value size is different
Memcache is a memory cache, key length is less than 250 characters, a single item store is less than 1M, not suitable for virtual machine use
Data consistency is different
Redis uses a single-threaded model to ensure that the data is submitted sequentially.
Memcache requires the use of CAs to guarantee data consistency. CAS (Check and Set) is a mechanism for ensuring concurrency consistency, which belongs to the category of optimistic locks; the principle is simple: take the version number, operation, contrast version number, if the operation is consistent, do not give up any action
CPU utilization
Redis single-threaded model can only use one CPU to open multiple Redis processes
Summary two:
In 1.Redis, not all data has been stored in memory, which is the biggest difference compared to memcached.
2.Redis not only supports simple k/v types of data, but also provides storage of data structures such as List,set,hash.
3.Redis supports data backup, that is, data backup in Master-slave mode.
4.Redis supports the persistence of data, can keep the data in memory on disk, restart can be loaded again to use.
I personally think that the most essential difference is that redis in many ways has the characteristics of the database, or is a database system, and memcached is just a simple k/v cache
Summary three:
The difference between Redis and Memecache is:
1, storage mode:
Memecache all the data in memory, the power will hang off, the data can not exceed the memory size
There are some redis on the hard drive, which guarantees the durability of the data.
2. Data support type:
Redis is much more than memecache in data support.
3, using the underlying model is different:
The new version of Redis directly builds the VM mechanism itself, because the general system calls the system function, it will waste a certain amount of time to move and request.
4, the operating environment is different:
Redis currently only supports Linux, which eliminates support for other systems, so that it can be better spent on optimizing the system's environment, although Microsoft has a team to write a patch for it later. But not on the trunk.
Memcache can only be cached, cache
Redis content can be landed, that is, similar to MongoDB, and then Redis can also be cached, and can be set Master-slave