Page MenuHomePhabricator

Add declarative pattern for ObjectCacheFactory (for use by MultiWriteBagOStuff)
Open, Needs TriagePublic

Description

Before the introduction of ObjectCacheFactory (ref. T358346: Introduce ObjectCacheFactory to MediaWiki core), we use to have 2 ways of constructing and getting BagOStuff cache instances:

  1. Through ObjectCache::getInstance() via code in PHP like in MediaWiki extensions etc;
  2. Through the $wgObjectCaches configuration/setting with a 'factory' => [ 'ObjectCache', 'getInstance' ] pattern.

As seen above, (2) is declarative and mostly happens in wmf-config where we declare the factory method to be called/invoked for a particular cache key. After the attempt of migrating ObjectCache to a proper factory and moving most things to service wiring, we have only 1 usage of the declarative pattern left (ref. https://codesearch.wmcloud.org/search/?q=%5C%27ObjectCache%5C%27%5C%2C+%5C%27getInstance%5C%27&files=&excludeFiles=&repos=), which is used by MultiWriteBagOStuff in mediawiki-config.

While we're in the process of deprecating and removing the ObjectCache class, we need a way for ObjectCacheFactory to still support the declarative pattern so that the MultiWriteBagOStuff config in $wgObjectCaches continues to work like today. @Krinkle pointed this out on a patch (ref. https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1068959) which as a result of that caused this task to be created.

Acceptance Criteria