redis
is a key-value storage system. Similar to Memcached, it supports relatively more stored value types, including string (string), list (linked list), set (set), zset (sorted set - ordered set) and hash (hash type).
When do you need to use redis?
● Does not require real-time updates but extremely consumes database data. For example, the product sales ranking list on the website can be counted once a day, and users will not pay attention to whether it is real-time.
● Data that needs to be updated in real time, but the update frequency is not high. For example, a user's order list would definitely like to be able to see the orders he has placed in real time, but most users will not place orders frequently.
● Data that is highly visited at a certain moment and updated frequently. A typical example of this kind of data is the flash sale. At the moment of the flash sale, there may be N times as much traffic as usual, and the system will be under great pressure. However, the cache used for this kind of data cannot be the same as the ordinary cache. This cache must be guaranteed not to be lost, otherwise there will be big problems.
The above is the detailed content of When do you need to use redis?. For more information, please follow other related articles on the PHP Chinese website!