I have fought back and forth with issues related to the Edge cache.
Sometimes it would work, sometimes it wouldn't sometimes it would hold on to
files way too long.
Well it hadn't been working at all for like 6 weeks, and I didn't mess with
it, but I got around to it today.
If you want edge caching to work you need to make sure you have done the
following things
1. Set Public If you don't set public it won't be cached ever.
2. Set a max-age . If you set public but don't specify max-age it
won't be cached
3. Use a comma. public, max-age=300 works fine. Public; max-age=300
does not.
4. Set an age greater than 60. 61 seems to cache. 60 does not. There
is probably some volume to will I cache based on expiration but 61 seconds
at the volumes we run seems to cache and 60 doesn't ever seem to.
5. Set an age less than 366 days. 364 days seems to work 365 works
most the time 366 never seems to work. So those "Expire never" kinds of
posts people talk about for versioned assets that never expire. Well 10
years is not the right answer.
6. Expires with a date, doesn't seem to help, and seemingly may
prevent caching in some instances. I think this may be clock drift. Or
something about how picky the parser is about the format of the date.
Things that work in browsers don't always work correctly in the edgecache.
(like the Semi vs the comma)
7. Set both Pragma and Cache-Control If Pragma is not set Public then
Cache-Control seems to be ignored.
This is all way more info than you probably need, but. Here is the relevant
code.
Here is the python code to set headers for caching (CACHE_EXPIRE is a
variable we set based on the page type)
self.response.headers['Cache-Control'] = 'public, max-age=%d' %
CACHE_EXPIRE
self.response.headers['Pragma'] = 'Public'
This is also available at
http://www.xyhd.tv/2011/11/industry-news/setting-cache-control-headers-in-py
thon-to-take-advantage-of-google-appengines-edgecache/
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.