One solution would be to use File.GetLastWriteTime to add an image to the URL.
You will get some performance gains, but if your name stays the same and you want to update the cache in real time, this will work for you:
string imageUrl = "/images/user.jpg";
imageUrl += "?ver=" + File.GetLastWriteTime(Server.MapPath(imageUrl)).ToFileTime();
Another solution would be to track the version of the image in the database and whenever the user uploads a new image, you change the version and add it to the URL.
source
share