Hi,
*TL;DR;*
We have started our journey of deprecating the ObjectCache https://doc.wikimedia.org/mediawiki-core/master/php/classObjectCache.html class and moving to ObjectCacheFactory https://doc.wikimedia.org/mediawiki-core/master/php/classObjectCacheFactory.html : https://gerrit.wikimedia.org/r/c/mediawiki/core/+/955771. This means we have stopped using the *$instances* member in ObjectCache. If you are an extension author or maintainer, please look at the new interface in ObjectCacheFactory and migrate callers (if you find any).
*Longer version*
Recently, there has been some on-going work on ObjectCache and we realized code was taking a factory based pattern due to various code paths to configure, setup and obtain BagOStuff cache instances. With this patch: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/955771, we created a proper MediaWiki factory service and deprecated various methods on the ObjectCache class including the static member `ObjectCache::$instances` which used to hold references to various instances of the caches (BagOStuff) - sounds familiar? Yes, we're getting rid of scattered usage of global state one class at a time :).
We have taken care of places [1][2][3] where this public member was referenced, so, we are certain there are no consumers of this field https://codesearch.wmcloud.org/deployed/?q=ObjectCache%3A%3A%5C%24instances both in MW core and extensions that we deploy today in production, and we encourage extension authors and maintainers to migrate to the new way of constructing and/or obtaining cache instances via ObjectCacheFactory which goes through our global services container (with DI capabilities).
You can also have a look at the Phabricator task [4] which explains the problem that this refactoring solves/improves and the impact it has on MediaWiki. The patch will ride the train next week (starting March 25th, 2024) and if there are any issues found along the way, please file a task and add #MediaWiki-lib-BagOStuff.
This work is only step 1 into unifying, centralizing and getting rid of global state in the logic related to the ObjectCache class and making it consistent with how we do things with the global services locator today in MediaWiki.
External/related links, see: * https://www.mediawiki.org/wiki/Manual:$wgObjectCaches * https://www.mediawiki.org/wiki/Object_cache
Thank you!
P.S: I personally want to thank Daniel Kinzler and Timo Tijhof for all the code review and guidance into making this work materialize and about to hit production. <3
[1] https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1011159 [2] https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ConfirmEdit/+/1009498 [3] https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DonationInterface/+/10... [4] https://phabricator.wikimedia.org/T358346
wikitech-l@lists.wikimedia.org