Cache imageinfo query in MultimediaViewer

Bug: T117750
Change-Id: I5560e14b13968113e768bacce9972169f270e7bc
This commit is contained in:
Andrew H 2016-01-06 04:05:59 +00:00
parent db3685e956
commit 6005b068bf
2 changed files with 7 additions and 5 deletions

View file

@ -28,6 +28,7 @@
*/
function MultimediaViewer( mwConfig ) {
var apiCacheMaxAge = 86400; // one day (24 hours * 60 min * 60 sec)
var apiCacheFiveMinutes = 300; // 5 min * 60 sec
/**
* @property {mw.Map}
@ -45,10 +46,10 @@
* @property {mw.mmv.provider.ImageInfo}
* @private
*/
this.imageInfoProvider = new mw.mmv.provider.ImageInfo( new mw.mmv.logging.Api( 'imageinfo' ),
// Short-circuit, don't fallback, to save some tiny amount of time
{ language: this.mwConfig.get( 'wgUserLanguage', false ) || this.mwConfig.get( 'wgContentLanguage', 'en' ) }
);
this.imageInfoProvider = new mw.mmv.provider.ImageInfo( new mw.mmv.logging.Api( 'imageinfo' ), {
language: this.mwConfig.get( 'wgUserLanguage', false ) || this.mwConfig.get( 'wgContentLanguage', 'en' ),
maxage: apiCacheFiveMinutes
});
/**
* @property {mw.mmv.provider.FileRepoInfo}

View file

@ -91,7 +91,8 @@
titles: file.getPrefixedDb(),
iiprop: provider.iiprop,
iiextmetadatafilter: provider.iiextmetadatafilter,
iiextmetadatalanguage: provider.options.language
iiextmetadatalanguage: provider.options.language,
uselang: 'content'
} ).then( function ( data ) {
return provider.getQueryPage( file, data );
} ).then( function ( page ) {