Ramdas Mayya
asked on
How to make images cache in a e-commerce sites
We are using a windows server to serve the images to our e-commerce site. The images are fetched using a flat url. and there is no set time out used in image tags.
So the images are being downloaded every next day if somebody accesses our site.
We may use some scene7 server or akamai kind of CDNs to cache our content. But I would like to know if there a way we can set time for caching static resources like image/css/js etc?
Or is there any other possible solution to download image from a server and make use of browser caching. ?
So the images are being downloaded every next day if somebody accesses our site.
We may use some scene7 server or akamai kind of CDNs to cache our content. But I would like to know if there a way we can set time for caching static resources like image/css/js etc?
Or is there any other possible solution to download image from a server and make use of browser caching. ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That may be a http server settings. Is there any other way to set the expiry time on dynamic images/js ?
What exactly do you mean by dynamic? Dynamically generated?
It shouldn't make any difference, it is still an image/file
Is this on IIS or Apache? PHP or .net...?
If IIS just amend the web.config like so to cache for 30 days
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAg e" cacheControlMaxAge="30.00: 00:00" />
</staticContent>
</system.webServer>
</configuration>
It shouldn't make any difference, it is still an image/file
Is this on IIS or Apache? PHP or .net...?
If IIS just amend the web.config like so to cache for 30 days
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAg
</staticContent>
</system.webServer>
</configuration>
Open in new window
You can specify the height and width of the images by adding dimensions after new Pic ie.New Pic(150,150).
Add other images as needed and increment with Pic 3, Pic 4 etc.