Simple aggressive caching with Google App Engine
Feb 6, 2013
One way of doing this is to embed a version number in the URL for each resource file. You can then give the resources an expiry time far in the future and, when you need to update them, change the version number and reference them at the new URL.
This is pretty straightforward with Google App Engine since you automatically get a versioned URL for your application at versionstring.yourapplication.appspot.com. So you can keep your app at yourapplication.appspot.com (or a custom domain) and reference your resources at the versioned URL. As a bonus this also means you avoid the overhead of cookie data being sent with every resource request.
For example, in my case I just use base and relative URLs to reference the resources:
<!-- "3-owap" is the name of the current version of my app -->
<base href='//3-owap.persuasiongame.appspot.com/persuasion/' />
<!-- Use relative URL to reference resource file -->
Then set a long expiration for your resources, e.g. (for a Java app):
<include path="/persuasion/res/**" expiration="365d" />