Issue
While looking into some formatterCache things in T252595 I noticed this.
Creating a module like such
local p = {} --p stands for package
function p.hello( frame )
return mw.wikibase.getLabelByLang('Q28', 'en')
end
return pAnd using it on a page like this on a client
{{#invoke:LuaTest|hello}}These values fetched never end up in or look at the formatterCache, which they probably should.
Using methods without the language we start using the cache.
return mw.wikibase.getLabel('Q28')There seems to be a mismatch between the caching policies of newLanguageIndependentLuaBindings / newLanguageDependentLuaBindings (both methods of Scribunto_LuaWikibaseLibrary).
Acceptance Criteria
- Caching policies between newLanguageIndependentLuaBindings and newLanguageDependentLuaBindings match (using caching in both when currently used i either one)
Notes
- mw.wikibase.getLabel does consider "language fallback"
- mw.wikibase.getLabelByLangdoes only get the label in the language request, not performing any "fallback" logic
- Conclusion of the above: those method should use distinct cache keys
- Environment to reproduce the behaviour under inspection: Scribunto extension must be enabled, repo-client pair needs to be set up. Client wiki would get a Lua module with the function calls as shown in the examples above.
Reading
https://doc.wikimedia.org/Wikibase/master/php/md_docs_storage_terms-caching.html