What is Redis suitable for?
Redis has a variety of data structures, which are suitable for many different application scenarios.
1. Use Redis for caching
Redis's string and hash table data structures are suitable for storing a large number of key-value pairs of information, so as to achieve cache.
two。 Use Redis as a queue
Redis has several data structures suitable for queuing:
Using the list data structure, you can achieve the functions of normal and priority queues.
Using the ordered set data structure, priority queues can be implemented:. Using the hash table data structure, delay queues can be implemented.
3. Use Redis to remove weight
Redis has several data structures that are suitable for weight removal:
Using the "set" data structure, we can realize the deduplication of small batches of data:
Using the bit operation of the "string" data structure, the Bloom filter can be implemented, thus realizing very large-scale data.
De-weight:
The deduplication and counting of super-large-scale data can be realized by using the HyperLogLog data structure of Redis.
4. Using Redis to realize scoreboard
The "ordered collection" function of Redis can not only realize the scoreboard function, but also realize the automatic sorting and ranking function.
5. Using Redis to implement publish / subscribe function
Redis's own publish / subscribe model can implement many-to-many publish / subscribe functions.