Image Cache Clear

Image Cache Clear

  

How to clear cache memory through java script? What i am trying to do is , whenever i am uploading new image i want to clear the previous created cache memory. Please suggest me

Hi Lovish,

Are you talking about the cache of your browser? If so, just google for "clear browser cash javascript" (without the quotes), and you'll find a number of examples.

no, i want to clear for the image widget cache. 

Hello Lovish,

May I ask if that image is accessed very often in your application or is just accessed times to times? If is not acessed very often, you can always set the Cache property to  'No Cache'.

Best Regards

Paulo Zacarias wrote:

Hello Lovish,

May I ask if that image is accessed very often in your application or is just accessed times to times? If is not acessed very often, you can always set the Cache property to  'No Cache'.

Best Regards


actually it is accessing time to time

Hi Lovish,

If you are using an Image Widget in a Web Application (I'm assuming), tere is a very nice trick you can use.
The browser caches an image based on the file name of it.

In the Image Widget, you have a property to set the file name, in case the user wants to download it.

So, what you can do, is to attach to the name something that identify the image "version". You can use a date/time, you can use a version number, etc.

If the image is the same, the file name will be the same, and the cache will work as expected. As soon as you change the file name (because it is a new image or a new version or new uploaded version, the new image will be downloaded, as there is no cache for it anymore.

Cheers,
Eduardo Jauch.

Eduardo Jauch wrote:

Hi Lovish,

If you are using an Image Widget in a Web Application (I'm assuming), tere is a very nice trick you can use.
The browser caches an image based on the file name of it.

In the Image Widget, you have a property to set the file name, in case the user wants to download it.

So, what you can do, is to attach to the name something that identify the image "version". You can use a date/time, you can use a version number, etc.

If the image is the same, the file name will be the same, and the cache will work as expected. As soon as you change the file name (because it is a new image or a new version or new uploaded version, the new image will be downloaded, as there is no cache for it anymore.

Cheers,
Eduardo Jauch.

So According to you, cache always take the name from FileName property? If Yes , Then two image with same name are uploaded then it will show the previous image. Is it?



Solution

Doesn't matter the name of the file when you upload it. What matters is the name you give in the property File Name. Because this will be the name that will be inserted in the tag img in the html that is sent to the browser, and is used by the browser to download the image when rendering the page.

The first time, it download it. The second time it renders a page, if the image is coming from the same place and have the same name from one that is in the cache, browser will use the one from the cache.

If the name is different, it is not in the cache, and it will download again.

So, when you want to force a new image to be downloaded, but still want to have the cache advantage, just change the file name of the image in the property of the image widget.

Solution

Eduardo Jauch wrote:

Doesn't matter the name of the file when you upload it. What matters is the name you give in the property File Name. Because this will be the name that will be inserted in the tag img in the html that is sent to the browser, and is used by the browser to download the image when rendering the page.

The first time, it download it. The second time it renders a page, if the image is coming from the same place and have the same name from one that is in the cache, browser will use the one from the cache.

If the name is different, it is not in the cache, and it will download again.

So, when you want to force a new image to be downloaded, but still want to have the cache advantage, just change the file name of the image in the property of the image widget.


Thanks Eduardo...... It is working fine now and thanks for the explanation