Difference between revisions of "API Caching Guidelines"

From King Arthur's Gold Wiki
Jump to: navigation, search
(Created page with "Resources on the API should be cached as follows when Expires: headers are not present.")
 
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Resources on the API should be cached as follows when Expires: headers are not present.
+
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 [https://forum.kag2d.com/forums/community-dev-corner.57/ Community Dev Corner Forums]
 +
 
 +
[[Category:API]]

Latest revision as of 04:41, 21 January 2013

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 Community Dev Corner Forums