The difference between redis and other cache databases

Redis and other key-value caching products have the following three characteristics:

(1) Redis supports data persistence, which can save data in memory on disk, and can be loaded again for use when restarting.

(2) Redis not only supports simple key-value type data, but also provides storage of data structures such as list, set, zset, and hash.

(3) Redis supports data backup, that is, data backup in master-slave mode.

The difference between Redis and Memcached

Redis is often compared with the high-performance key-value cache server Memcached: both can be used to store key-value pairs, and their performance is similar to each other, but Redis relatively supports more data types, in addition to supporting key-value pairs In addition, it also supports the storage of data structures such as list, set, zset, and hash, while Memcached can only store ordinary string keys.

Memcached users can only APPENDadd data to the end of an existing string and use the string as a list. However, when deleting these elements, Memcached uses a blacklist to hide the elements in the list, thereby avoiding operations such as reading, updating, and deleting elements. In contrast, Redis' List and Set allow users to add and remove elements directly.

Other differences between Redis and Memcached are as follows:

1. Both Redis and Memcached store data in memory, both of which are in-memory databases. However, Memcached can also be used to cache other things, such as pictures, videos, etc.;

2. Redis not only supports simple K/V type data, but also provides storage of data structures such as List, Set, and Hash;

3. Virtual memory – When Redis runs out of physical memory, it can exchange some values ​​that have not been used for a long time to disk;

4. Expiration policy – ​​Memcached is specified when set, for example: set key1 0 0 8, that is, it will never expire. Redis can be expire set by e.g.: expire name 10;

5. Distributed – Set up a Memcached cluster and use magent to be one master and multiple slaves; Redis can be one master and multiple slaves. can be master and slave;

6. Data storage security – after Memcached hangs, the data is gone; Redis can be regularly saved to disk (persistence);

7. Disaster recovery – after Memcached hangs, the data cannot be recovered; Redis data can be recovered through AOF after it is lost;

8. Redis supports data backup, that is, data backup in Master-Slave mode;

9. Different application scenarios: In addition to being used as a NoSQL database, Redis can also be used as a message queue, data stack, and data cache; Memcached is suitable for caching SQL statements, datasets, user temporary data, delayed query data, and sessions, etc. .

The difference between Redis and other databases

write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325301785&siteId=291194637