* @ingroup Change tagging
*/
+use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\Database;
class ChangeTags {
if ( !Hooks::isRegistered( 'ChangeTagsListActive' ) ) {
return $tags;
}
- return ObjectCache::getMainWANInstance()->getWithSetCallback(
- wfMemcKey( 'active-tags' ),
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ return $cache->getWithSetCallback(
+ $cache->makeKey( 'active-tags' ),
WANObjectCache::TTL_MINUTE * 5,
function ( $oldValue, &$ttl, array &$setOpts ) use ( $tags ) {
$setOpts += Database::getCacheSetOptions( wfGetDB( DB_REPLICA ) );
return $tags;
},
[
- 'checkKeys' => [ wfMemcKey( 'active-tags' ) ],
+ 'checkKeys' => [ $cache->makeKey( 'active-tags' ) ],
'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
'pcTTL' => WANObjectCache::TTL_PROC_LONG
]
public static function listExplicitlyDefinedTags() {
$fname = __METHOD__;
- return ObjectCache::getMainWANInstance()->getWithSetCallback(
- wfMemcKey( 'valid-tags-db' ),
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ return $cache->getWithSetCallback(
+ $cache->makeKey( 'valid-tags-db' ),
WANObjectCache::TTL_MINUTE * 5,
function ( $oldValue, &$ttl, array &$setOpts ) use ( $fname ) {
$dbr = wfGetDB( DB_REPLICA );
return array_filter( array_unique( $tags ) );
},
[
- 'checkKeys' => [ wfMemcKey( 'valid-tags-db' ) ],
+ 'checkKeys' => [ $cache->makeKey( 'valid-tags-db' ) ],
'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
'pcTTL' => WANObjectCache::TTL_PROC_LONG
]
if ( !Hooks::isRegistered( 'ListDefinedTags' ) ) {
return $tags;
}
- return ObjectCache::getMainWANInstance()->getWithSetCallback(
- wfMemcKey( 'valid-tags-hook' ),
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ return $cache->getWithSetCallback(
+ $cache->makeKey( 'valid-tags-hook' ),
WANObjectCache::TTL_MINUTE * 5,
function ( $oldValue, &$ttl, array &$setOpts ) use ( $tags ) {
$setOpts += Database::getCacheSetOptions( wfGetDB( DB_REPLICA ) );
return array_filter( array_unique( $tags ) );
},
[
- 'checkKeys' => [ wfMemcKey( 'valid-tags-hook' ) ],
+ 'checkKeys' => [ $cache->makeKey( 'valid-tags-hook' ) ],
'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
'pcTTL' => WANObjectCache::TTL_PROC_LONG
]
* @since 1.25
*/
public static function purgeTagCacheAll() {
- $cache = ObjectCache::getMainWANInstance();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
- $cache->touchCheckKey( wfMemcKey( 'active-tags' ) );
- $cache->touchCheckKey( wfMemcKey( 'valid-tags-db' ) );
- $cache->touchCheckKey( wfMemcKey( 'valid-tags-hook' ) );
+ $cache->touchCheckKey( $cache->makeKey( 'active-tags' ) );
+ $cache->touchCheckKey( $cache->makeKey( 'valid-tags-db' ) );
+ $cache->touchCheckKey( $cache->makeKey( 'valid-tags-hook' ) );
self::purgeTagUsageCache();
}
* @since 1.25
*/
public static function purgeTagUsageCache() {
- $cache = ObjectCache::getMainWANInstance();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
- $cache->touchCheckKey( wfMemcKey( 'change-tag-statistics' ) );
+ $cache->touchCheckKey( $cache->makeKey( 'change-tag-statistics' ) );
}
/**
*/
public static function tagUsageStatistics() {
$fname = __METHOD__;
- return ObjectCache::getMainWANInstance()->getWithSetCallback(
- wfMemcKey( 'change-tag-statistics' ),
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ return $cache->getWithSetCallback(
+ $cache->makeKey( 'change-tag-statistics' ),
WANObjectCache::TTL_MINUTE * 5,
function ( $oldValue, &$ttl, array &$setOpts ) use ( $fname ) {
$dbr = wfGetDB( DB_REPLICA, 'vslow' );
return $out;
},
[
- 'checkKeys' => [ wfMemcKey( 'change-tag-statistics' ) ],
+ 'checkKeys' => [ $cache->makeKey( 'change-tag-statistics' ) ],
'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
'pcTTL' => WANObjectCache::TTL_PROC_LONG
]