mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RelatedArticles
synced 2024-11-24 00:05:50 +00:00
Cache "morelike" requests for all users
In order to minimize loading time of RA for as many users as possible, we need to maximize the number of users that can be served by our edge caches. Currently, if you're logged in, then the API uses your language by default and so responses are always private, i.e. they shouldn't be cached by a shared cache and can be cached by the browser. By requesting that the response be in the language of the content, the API ignores your language and responses become public, i.e. they can be cached in a shared cache and can be cached by the browser. Changes: * Add the `uselang=content` parameter to the morelike request * Add the `maxage=86400` parameter to the morelike request, allowing the browser to cache the response for 24 hours, which'll save the device even making the request Bug: T126455 Change-Id: I6216a088d865f27f7cc3725fc311191da42a27ba
This commit is contained in:
parent
45f922fd66
commit
8b8db66dd1
|
@ -77,7 +77,22 @@
|
|||
parameters.gsrnamespace = '0';
|
||||
parameters.gsrlimit = limit;
|
||||
parameters.gsrqiprofile = 'classic_noboostlinks';
|
||||
parameters.smaxage = 86400; // 24 hours
|
||||
|
||||
// Currently, if you're logged in, then the API uses your language by default ard so responses
|
||||
// are always private i.e. they shouldn't be cached in a shared cache and can be cached by the
|
||||
// browser.
|
||||
//
|
||||
// By make the API use the language of the content rather than that of the user, the API
|
||||
// reponse is made public, i.e. they can be cached in a shared cache.
|
||||
//
|
||||
// See T97096 for more detail and discussion.
|
||||
parameters.uselang = 'content';
|
||||
|
||||
// Instruct shared caches that the response will become stale in 24 hours.
|
||||
parameters.smaxage = 86400;
|
||||
|
||||
// Instruct the browser that the response will become stale in 24 hours.
|
||||
parameters.maxage = 86400;
|
||||
} else {
|
||||
return $.Deferred().resolve( [] );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue