Difference between revisions of "API Caching Guidelines"
m |
|||
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 [Community Dev Corner Forums|https://forum.kag2d.com/forums/community-dev-corner.57/] | ||
[[Category:API]] | [[Category:API]] |
Revision as of 14:58, 6 September 2012
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|https://forum.kag2d.com/forums/community-dev-corner.57/]