Solved

How to make images cache in a e-commerce sites

Posted on 2013-12-30
4
288 Views
Last Modified: 2014-01-03
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. ?
0
Comment
Question by:Ramdasa Mayya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:David Carr
ID: 39748346
Here is some code you can put in your HTML in the <head> section
<script type="text/javascript">

<!-- hide from non JavaScript Browsers

Pic1= new Pic
pic1.src = "pic1.jpg"

Pic2 = new Pic
Pic2.src = "pic2.jpg"

// End Hiding -->
</script>

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.
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39748415
This will depend on your HTTP server (?) on how you set the expiry date for assets.
0
 
LVL 4

Author Comment

by:Ramdasa Mayya
ID: 39754561
That may be a http server settings. Is there any other way to set the expiry time on dynamic images/js ?
0
 
LVL 58

Expert Comment

by:Gary
ID: 39754583
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="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
    </staticContent>
  </system.webServer>
</configuration>
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Businesses who process credit card payments have to adhere to PCI Compliance standards. Here’s why that’s important.
An overview of how to create reports in Adobe Analytics (formerly Omniture Site Catalyst) using pageNames, events, eVars and props. This video will show you how to install the Omniture Debugger tool so can see (and test) what is being passed int…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question