1. the redis List is used as a queue, Which is lightweight and does not need to be introduced to other queue servers. The disadvantage is that data may be lost because its persistence scheme is redis's common aof or rdb method 2. put the sorted Object id in the LIST, and use the prefix Object id as the key to store the specific object information with hashtable. 3. use ZSET to store rankings and permissions
1. the redis List is used as a queue, Which is lightweight and does not need to be introduced to other queue servers. The disadvantage is that data may be lost because its persistence scheme is redis's common aof or rdb method 2. put the sorted Object id in the LIST, and use the prefix Object id as the key to store the specific object information with hashtable. 3. use ZSET to store rankings and permissions
1. Use the redis List as a queue. This is lightweight and does not need to be introduced to other queue servers. The disadvantage is that data may be lost because the persistence scheme is redis's common aof or rdb method.
2. Put the sorted object IDs in the LIST, and use the prefix Object id as the key to store specific object information with hashtable
3. Use ZSET to store rankings and entity IDs with weight information. The disadvantage is that the memory usage is too high.
4. Use hashtable for some ing, such as username => user_id.
5. set can support some logical operations, but the sorting time is not complex, so I chose to use list
6. set is used for uniqueness verification. If a user has liked an article
7. Use redis to optimize parameters such as memory hash-max-zipmap-entries to reduce memory usage
8. You can also use the getRange and setRange commands of string for sequential access to sorted IDs.
A poor result of using LIST is that the order has been determined, and the delete operation time is O (n). Sequential search and deletion are not supported, and operations such as union inter are not supported, these operations can simulate and or.
There are so many things that can be remembered for the moment.
The main focus is to create an index by yourself. The index is the key index, and then access the value through the key. In this way, the access is simplified to k => v. Complex SQL statements can be divided into redis operations.
Application scenarios that I can think:
Advanced Cache
Counter
Bloom filter/simple permission (bit operation type)
Stack/queue/priority queue
Lock/id generator Cache/short url Cache
SNS relationship
Mapreduce/drift bottle/deduplication
Timeline
Index/ranking/last N
Timeout (for example, verification)
Chat/Subscribe/notify
Session
Communication Middleware
Source: http://www.imsiren.com/archives/982