API Caching Guidelines

From King Arthur's Gold Wiki
Revision as of 14:59, 6 September 2012 by FliesLikeABrick (Talk | contribs)

Jump to: navigation, search

Resources on the API should be cached as follows when Expires: headers are not present. You should write your code to use the Expires: and other cache control headers when they are available, but fall back to these recommendations otherwise:

  • /server/.../status: 30 seconds
  • /servers: 5 minutes
  • /player/.../info: 5 minutes
  • /player/.../status: 30 seconds

You are of course welcome to cache these resources for longer, depending on the sensitivity of your application and users to stale data.

Expires, Last-Modified and Cache-Control headers will be added for all resources as the developers have time to add them.

Caching is not mandatory, but is strongly recommended as a best practice if you are using the API in a website. Without it, you risk hitting per-IP-Address rate limits and running into other load-related problems. Plus, the more you cache (within reason), the more you're being a good netizen and helping prevent our servers from catching on fire!

As always, if you have any questions, concerns, comments or feature requests, please visit the Dev Corner Forums