What is the principle of storage and reading of SF's avatar?

Source: Internet
Author: User
This time in a Community system, found that the user's avatar is ubiquitous if the user ID to go to the database query, query too often, someone knows how the SF avatar storage and read how to achieve it?
Avatar Address
http://sfault-avatar.b0.upaiyun.com/377/866/3778663381-1030000000092007_huge128

http://sfault-avatar.b0.upaiyun.com/: Image domain Address
1030000000092007 User ID
huge128 size

What is 3778663381? Random number?
377/866 the directory generated by this number

When reading the user picture is how to read, through the rules to splice the address, or directly according to the user ID to go to the database to read the user's avatar address?

Reply content:

This time in a Community system, found that the user's avatar is ubiquitous if the user ID to go to the database query, query too often, someone knows how the SF avatar storage and read how to achieve it?
Avatar Address
http://sfault-avatar.b0.upaiyun.com/377/866/3778663381-1030000000092007_huge128

http://sfault-avatar.b0.upaiyun.com/: Image domain Address
1030000000092007 User ID
huge128 size

What is 3778663381? Random number?
377/866 the directory generated by this number

When reading the user picture is how to read, through the rules to splice the address, or directly according to the user ID to go to the database to read the user's avatar address?

Take a look at the documents for the cloud again.

Usernames and IDs are also ubiquitous and require frequent queries (whether stored in MySQL or other kvdb).
With the user name and ID, it is not easy to generate a unique picture name.

SF's avatar address each user is fixed, the middle of the user ID, the front of the current do not know what is.

But certainly not from the database read, the efficiency is too low. Should be based on an algorithm generated by an address, regardless of how to upload the avatar will be the same address.

  • Related Article

    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.