11

How often does Akamai refresh cache?

We use Akamai to cache frequently accessed files. When uploading and overwriting files to the Akamai FTP, I can't see the new file reflected live.

Anybody have any experience with this?

4 Answers 4

14

Bear in mind that the files may be cached elsewhere as well, including at any proxy servers that the client is behind or in the browser's cache itself. An easy way to get around this is to add a query string to the URL, and change the value each time you update the files, or set it to a random value to bypass the cache each time. The server will ignore the query string, but the browser and proxies will think it is a completely different URL and re-request it.

For instance, instead of requesting:

styles.css

request:

styles.css?version=1

2
  • 1
    I know this is a really old thread, but does this work for akamai? Meaning, will akamai pull a new version of the file from your origin by just changing the query string?
    – JoeyP
    Mar 23, 2011 at 20:30
  • 1
    It works for Akamai, but you have to configure it to take into account query parameters. I'm not sure what the default is. Jul 3, 2013 at 8:55
11

It is configurable. You will need to talk to whoever in your organisation manages your Akamai account. They will have access to change how and what things are cached. If necessary, they can put you in touch with a technical contact at Akamai.

0
1

Another thing to check is the time to live set for items Akamai caches.

I use Akamai at work, recently found that it will cache indefinitely anything with a max-age of zero. Then when I'd corrected that to something more useful, it randomly returned old and new items from the same url. You could see in the header content that the old items, in this case PDF files, still had a max age of zero, where as the current PDFs had the new max age value.

To remedy this we had to clear the urls from Akamai so that it cached new versions of the PDFs, using the corrected max age value. Now the effected PDFs only stay cached for the new max age time, and we consistently receive the correct versions.

0

Files on the Akamai network can be tuned with whatever cache configuration the end customer requires. Typically the two most common approaches to cache design I see are:

  1. Configuring based on file extension. (e.g. *.css, *.js, etc)
  2. Configuring based on path. (/product/test /checkout, etc)

If you enable the following pragma headers to your request then you can inspect the HTTP response headers and determine the cache length of the file - it's included in the cache key.

Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no, akamai-x-get-request-id,akamai-x-get-nonces,akamai-x-get-client-ip,akamai-x-feo-trace

e.g the following indicates a file cached for 4 days:

x-cache-key:S/L/3568/82745/4d/mirror-somedomain.akadns.net/contentimages/meganav/020118/2018-02-01-someimg.jpg cid=_site_locale=us&site_language=en_

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.