User:Puxlit/MediaWiki API Cache Modes


 * motivation:
 * ( mode) won't pass through   of   with   for anon users
 * useful cache headers is desirable for reducing number of requests by AddRailModule
 * overview:
 * entry point: https://github.com/Wikia/app/blob/release-807.001/api.php
 * cache modes: https://github.com/Wikia/app/blob/release-807.001/includes/api/ApiMain.php#L246-L288
 * generation of cache headers: https://github.com/Wikia/app/blob/release-807.001/includes/api/ApiMain.php#L410-L489
 * other points of interest:
 * https://github.com/Wikia/app/blob/release-807.001/includes/OutputPage.php
 * empirical testing:
 * permutations: config ⨯ {t + 0s, t + 10s}
 * config = candidates ⨯ {without smaxage/maxage, with smaxage = maxage = 600} ⨯ {anon, logged in}
 * curl: curl --verbose --compressed --globoff&#xa;    -H 'fastly-debug: 1'&#xa;     -H 'fastly-no-shield: 1'&#xa;     -H 'cookie: […]'&#xa;     'https://dev.wikia.com/api.php?format=json&smaxage=[…]&maxage=[…]&requestid=[…]&[…]'
 * omit  header for anon config, and supply appropriate cookies for logged in config
 * use  param for controlled cache busting
 * candidates:
 * for,  :
 * cache mode is defined: https://github.com/Wikia/app/blob/release-807.001/includes/api/ApiQuerySiteinfo.php#L521
 * cache mode is passed through: https://github.com/Wikia/app/blob/release-807.001/includes/api/ApiQuery.php#L291-L292
 * for,  :
 * cache mode is defined: https://github.com/Wikia/app/blob/release-807.001/includes/api/ApiQueryBase.php#L62 ← https://github.com/Wikia/app/blob/release-807.001/includes/api/ApiQueryUserInfo.php#L32
 * cache mode is passed through: https://github.com/Wikia/app/blob/release-807.001/includes/api/ApiQuery.php#L293-L294
 * for,   (without  ):
 * cache mode is defined: https://github.com/Wikia/app/blob/release-807.001/includes/api/ApiQueryAllmessages.php#L190-L192
 * cache mode is passed through: https://github.com/Wikia/app/blob/release-807.001/includes/api/ApiQuery.php#L287-L289
 * expectation versus reality: TODO