Background: I am creating a crash generation system on the Internet where the user can select fragments for his avatar (for example, body, background, eyes, mouth, jacket, pants, etc.). and then an image is created from these selections. For performance reasons, I then intend to do the following: from the list of selected items, create a file name containing their identifiers, and save the image under this file name. Then, when the request comes for the image, the web server will serve it directly. If the image is not found, the 404-handler will generate it. And then the problem is:
Question: I would like to compress the list of integers as short as possible, consisting only of ASCII characters (used for file names and URLs). Integers will be unique and greater than 0 (0 by itself will not be among them). I expect that there may be about 20 of them, and they will not exceed 200, but this is just an assumption (although I would be surprised if they passed in 500 years). Order is not important.
What do you recommend me to do?
Update: . I seem to have made a fundamental mistake. I wanted to avoid storing each generated avatar in the database, instead storing all the necessary information in the file name. Thus, I was hoping to avoid unnecessary use of the database and thus improve performance. However, today it seemed to me that people might want to change their avatars and expect them to be updated wherever they were used. Therefore, the file name must be constant. This leaves only one option - I will need to save the information about the avatar in the database. And then I could also use a GUID or some other random strings for file names.
Thank you for your help, everyone, and sorry for the false alarm. :(
source
share