Revalidate Cache On Static Files In Google App Engine

I’m using Google App Engine to cache my static files for a while now. So far, i’m quite happy with my blog performance and using Google App Engine as CDN is definitely improve my blog page speed. I even upgrade to add more bandwidth, since i exceed the bandwidth quite often.

After using it quite sometimes, and i was have an issue with the cache. Google App Engine cache my static files to all the edge servers. So when i’m doing an update (in css file for example), it was still show the old file instead of the new updated file. It is still cached.

So how to trick this issue, so you can access the new updated file instead of old file? You can add version query string at the end of your file url.
For example:
Url without query string: http://cdn.ivankristianto.com/styles/min.css
Url with query string: http://cdn.ivankristianto.com/styles/min.css?v=1.0

So when i update my css file, i just need to increment the version, so i will get the new updated css file. It is a small trick to revalidate you cache files in Google App Engine, but help a lot when fixing my design.

Comments

  1. james.mortensen says:

    Do you do this automatically — adding the version to your CSS query string — or do you have to remember to do this manually to every single file that you need to flush? Is there an automated way to do this?

    It's almost worth just hosting the static files somewhere else until Google finally fixes this problem.

    • i create the WordPress theme myself so it is easy for me to change the css query string. Just increment it and save. and my theme will use the latest css from app engine.
      I don't think there is a way to automate this since you have to update your files with appengine sdk which is i don't know if there is an API for it, so i can embed the batch file.

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.