How Redis maintains a list of users

Source: Internet
Author: User
Keywords Php redis
Want to maintain a list of users through Redis.
1.redis provides list, set, hash map, which data structure to choose, save a PHP user object appropriate?
2. How do I maintain a user list with Redis? can be increased and reduced, can be viewed in quantity.

Reply content:

Want to maintain a list of users through Redis.
1.redis provides list, set, hash map, which data structure to choose, save a PHP user object appropriate?
2. How do I maintain a user list with Redis? can be increased and reduced, can be viewed in quantity.

If it is unordered, use set to store the user's unique ID, for example, SADD users {id} and then use a hash map to store the user's various properties, such as HSET user_{id} name "Tom" . So you can see the number of users in set, and then add and subtract in the set, the synchronization operation of the corresponding user in the hash line

  • 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.