Page MenuHomePhabricator

Discuss and replace usage of CACHE_ANYTHING with $wgMainCacheType
Closed, DuplicatePublic

Description

Currently in a lot of places in the Translate extension, we're using,

$cacheval = wfGetCache( CACHE_ANYTHING )->get( $cachekey );

During development this becomes a bit of a problem, because you cannot disable it. Instead using $wgMainCacheType might make sense since it can be set to CACHE_NONE to disable caching.

Here are some other notes and docs that might help,

  1. https://www.mediawiki.org/wiki/Manual:$wgMainCacheType
  2. https://gerrit.wikimedia.org/g/mediawiki/core/+/9b4461c1b8027049d575bc66b45a1545bd506188/includes/objectcache/ObjectCache.php#227

Event Timeline

abi_ triaged this task as Low priority.

For the specific cause of Special:LanguageStats/Special:MessageGroupStats $wgMainCacheType is better (optional short term caching to increase performance). Other cases need to be evaluated carefully too before changing them.

We should also consider going for MediaWikiServices::getInstance()->getMainWANObjectCache() or MediaWikiServices::getInstance()->getMainObjectStash() directly. I'm not sure about which one of those is better though.