views:

7

answers:

0

I wrote an ashx handler to return a thumbnail image and in order to avoid the cost of having to re-create the thumbnail every time it is requested, I save it to the disk. so next time a certain thumbnail size is requested, I check if it exists first. If it does I create the thumbnail,save it, create an image object from the saved file and write it to the output stream.

The concern I have is what might happen if two requests are made to retrieve the image. What if i try to save the image while another request is being issued? should i just go ahead and re-generate the thumbnail everytime to avoid this problem?