Developer forum

Forum » CMS - Standard features » Clear Image Cache

Clear Image Cache

Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

Is there any backend function that use to clear image cache from admin panel.

because when image replace with new one customer face issue on caching 


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Shiwanka

GetImage will automatically create a new image if a new one is uploaded - given the date modified is newer than the thumbnail.

In backend, you can force it by going to Files->Cache->Image and just delete that entire folder.

But I do not think that is the issue - I think it is browser cache. You can do CTRL+F5 to force upgrade the browser cache.

You can also disable the browser cache of images using "Web & Http"-> HTTP and set the output cache to 0 - meaning no browser cache. THIS IS NOT RECOMMENDED as it would cause enourmous performance issues and server load.

BR Nicolai

Votes for this answer: 1
 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

Thanks Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Is there a better solution for this today? I am hit by the same. Ctrl+F5 is nice for backend users, but not for frontend users. Isn't there an option like etags to tell the browser whether the image has changed or not?

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

This is how web cache works... You have the choice between a slow(er) website or have to wait for the cache to invalidate.

DW do send out an etag - but also sends out a max-age. Not until the max-age is reached will the browser send a request for that image using the etag in a If-None-Match header and will receive a 304 back if the image has not changed.

So both things are at play here - if you set max-age to 0, there will be a lot of requests for the images to ask the server if it was changed - and then you get the 304 back. But then you will not avoid the many requests, just the size of the response. SEO and Lighthouse will be very red if you do this.

So it is a very bad practice to set the max-age to low values.

If you indeed have "Image1.jpg" in a new version, call it "image1_new.jpg"

If it is a really big deal and this happens over and over again, you can change the image to do Getimage.ashx?....&ts=23489123412 and read the time stamp from server. Just a lot of i.o....

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> So it is a very bad practice to set the max-age to low values.

Agreed

>> If you indeed have "Image1.jpg" in a new version, call it "image1_new.jpg"

Yeah, that's what I have been telling the customer also.

>> If it is a really big deal and this happens over and over again, you can change the image to do Getimage.ashx?....&ts=23489123412 and read the time stamp from server. Just a lot of i.o....

Yep, and it looks like that's what I'll implement next.

Imar

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Customer Bei****m?

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Nope :-) 

 

You must be logged in to post in the forum