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.