mediawiki-extensions-Popups/doc/adr/0009-utilize-browser-caching.md
Stephen Niedzielski 133c921098 Doc: ADR for replacing Mustache with ES6 strings
Add architectural decision record for replacing Mustache.js with ES6
template literals. Also, fix the date format on a previous ADR to be
consistent with the others.

Bug: T165036
Change-Id: I561ab4aaf6258e27cb12787b370407626547d48c
2018-03-23 09:17:52 -05:00

1.3 KiB

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, 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. Unlike the MediaWiki API, resources fetched from the RESTBase endpoint, will be cached for 14 days in public caches.