Penguins Rising: Caching in Google App Engine
One day while I was exploring Google's Page-speed Insights to determine whether there was anything I could possibly improve with Penguins Rising. I discovered that I was not Leveraging the browser cache. Up to this point the only type of caching I had done was with the HTML5 cache manifest, however this was different than what Page-speed insight was advising me with and this was also what lead me to my question that is the majority of what this article is about.
Question
Lucky for me, I am not the only person to have asked this, but "What is the difference between a Cache Manifest and a Cache header?" As it stand with Page-speed Insight my current results with Penguins Rising (will vary) as you can see for yourself.
Using Expiration in the Content Header
You can set the expiration time however you like, I tested my application with 10 minute expiration date.
//Inside the app.yaml
default_expiration: "10m"
An Example using a image |
Warning
Once you set the expiration in the header it will hold the cached files unless they have expired or are removed. Removing the files isn't as simply as clearing the cache in the Settings for chrome. You have to locate the cache folder for chrome and remove whatever is inside it to clear out the cache.
For Windows 7: %AppData%\..\Local\Google\Chrome\User Data\Default
Solution
I needed up not using this in my final solution but it was important that I understood the differences and the effects that it would have. Instead I went with the Cache Manifest since I would have great control with what has been cached. Since I'm not worried about supporting older browsers it is a valid choose with everything else I have built so far. By Google's Page-speed Insight application I am still not leveraging the browser cache but in fact I am.
Further Explanation
With the Cache Manifest already implemented, I thought it was important to have as a lot of users that play have been accessing it over mobile devices and since a lot of carriers have limited internet plans it would just make it easier for my users to start the game while connected and continue regardless of their connection.
Resources
Static cache expiration - Python GAE