1. Counter
You can perform self increasing and self decreasing operation on string to realize the counter function.
Redis, a memory database, has very high read-write performance and is very suitable for storing the count of frequent reads and writes.
2. Cache
Put the hot data into memory, set the maximum memory usage and elimination strategy to ensure the cache hit rate.
3. Session cache
Redis can be used to uniformly store the session information of multiple application servers.
When the application server no longer stores the user’s session information, it no longer has state. A user can request any application server, so it is easier to achieve high availability and scalability.
4. Full page cache (FPC)
In addition to the basic session token, redis also provides a very simple FPC platform.
Take Magento as an example. Magento provides a plug-in to use redis as the back-end of full page caching. (fhadmin. CN) in addition, for WordPress users, Pantheon has a very good plug-in WP redis, which can help you load the pages you have visited as quickly as possible.
5. Lookup table
For example, DNS records are suitable for redis storage.
Similar to the cache, the lookup table also uses redis’s fast lookup feature. However, the contents of the lookup table cannot be invalidated, and the contents of the cache can be invalidated, because the cache is not a reliable data source.
6. Message queuing (publish / subscribe function)
List is a two-way linked list that can write and read messages through lpush and rpop
However, it is best to use message oriented middleware such as Kafka and rabbitmq.
7. Distributed lock implementation
In a distributed scenario, it is not possible to synchronize processes on multiple nodes using locks in a stand-alone environment.
You can use the setnx command provided by redis to implement distributed locks. In addition, you can also use the official redlock distributed lock.
8. Others
Set can realize operations such as intersection and union, so as to realize functions such as common friends.
Zset can realize orderly operation, so as to realize ranking and other functions.
This work adoptsCC agreement, reprint must indicate the author and the link to this article