toan added a comment.

  I set this up locally as such updating the independent lua bindings to use 
CachingPrefetchingTermLookup supported by the shared cache.
  
  simple module allowing to pass the language to getLabelByLang and one using 
the default language
  
    local p = {} --p stands for package
    
    function p.testAddStatementUsage( frame )
        return mw.wikibase.getLabelByLang( 'Q1', frame.args[1] )
    end
    
    function p.testAddStatementUsageNoLang( frame, entityID, property )
        return mw.wikibase.getLabel( 'Q1' )
    end
    
    return p
  
  And as follows on the client
  
    should be english
    
    {{#invoke:LuaTest|testAddStatementUsage|en}}
    
    should be german, but not found
    
    {{#invoke:LuaTest|testAddStatementUsage|de}}
    
    should be swedish
    
    {{#invoke:LuaTest|testAddStatementUsage|sv}}
    
    should be default lang 
    
    {{#invoke:LuaTest|testAddStatementUsageNoLang}}
  
  Since they are sharing the same cache and currently the same method for 
building the cacheKey the cache will **indeed be shared.**
  
  currently they can't even share this without crashing as
  
  `mw.wikibase.getLabel( 'Q1' )` is storing an array in the cache
  
  F32411658: image.png <https://phabricator.wikimedia.org/F32411658>
  
  `mw.wikibase.getLabelByLang( 'Q1', 'en' )` using CachingPrefetchingTermLookup 
is relying on only storing the term.
  
  F32411661: image.png <https://phabricator.wikimedia.org/F32411661>

TASK DETAIL
  https://phabricator.wikimedia.org/T266141

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: toan
Cc: toan, Aklapper, Lucas_Werkmeister_WMDE, Akuckartz, Iflorez, darthmon_wmde, 
alaa_wmde, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, 
_jensen, rosalieper, Scott_WUaS, Jonas, Wikidata-bugs, aude, Lydia_Pintscher, 
Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to