I currently use redis

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.