I have a webshop, where the user can personalize a product, by entering some text into a form. After he has submitted the text, my server generates a preview image and shows it to the user.
Since I do not want to regenerate the image on every page refresh (it takes to much time), I save the image on the server, with a unique hashed name, so I can just show the image again, as long the session runs. At the moment, I delete these "cached" files once a day by a cronjob.
My question is: Can I just save the files to the /tmp directory, so that I dont need the cronjob and get files deleted on every reboot? Are there any problems with my new solution?
I am using ubuntu 16.04 and php 5.6.