mediawiki-extensions-Popups/docs/adr/0009-utilize-browser-caching.md
Stephen Niedzielski 8ba5c0f773 Hygiene: make JSDoc configs consistent
Make the Popups, MobileFrontend, and MinervaNeue JSDocs consistent. For
Popups, specify package.json, readme, and default template options and
moved doc/ to docs/ and autogenerated JavaScript documentation from
doc/autogenerated to docs/js.

http://usejsdoc.org/about-configuring-jsdoc.html
http://usejsdoc.org/about-commandline.html
http://usejsdoc.org/about-configuring-default-template.html

Bug: T188261
Change-Id: I81e64f06265f1ecc4e2ee159deef9b204ea7e957
2018-07-23 14:45:14 -05:00

35 lines
1.3 KiB
Markdown

# 9. Utilize browser caching
Date: 24/05/2017
## Status
Accepted
## Context
We needed to make sure we're not overloading the servers with excessive
requests. We wanted to find a way to serve fresh resources while keeping
the back-end happy.
## Decision
Page Previews will leverage the browser's cache rather than maintaining its own.
We rely on Grade A browsers implementing HTTP caching correctly and their
vendors making accessing them as efficient as possible in order to avoid
incurring the incidental complexity of writing our own cache in JavaScript.
We'll set appropriate `Cache-Control` HTTP headers for both the MediaWiki API,
via [the `maxage` and `smaxage` main module parameters][0], and the RESTBase page
summary endpoint with the help of the Services team.
## Consequences
Resources fetched from the MediaWiki API [will be cached for 5 minutes in public
caches and the browsers's cache][1]. Unlike the MediaWiki API, resources fetched
from the RESTBase endpoint, [will be cached for 14 days in public caches][2].
[0]: https://www.mediawiki.org/wiki/API:Main_module#Parameters
[1]: https://github.com/wikimedia/mediawiki-extensions-Popups/blob/86075fba/src/gateway/mediawiki.js#L15
[2]: https://github.com/wikimedia/mediawiki-services-restbase-deploy/blob/9a86d4ce/scap/templates/config.yaml.j2#L100-L101