Jack Phoenix has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/403871 )
Change subject: wfMemcKey (deprecated in MW 1.30) -> makeKey() on a BagOStuff
instance
......................................................................
wfMemcKey (deprecated in MW 1.30) -> makeKey() on a BagOStuff instance
Change-Id: Ibd174f842230118285b682b03c49ec2a432f7764
---
M backend/CodeRepository.php
M backend/RepoStats.php
2 files changed, 14 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeReview
refs/changes/71/403871/1
diff --git a/backend/CodeRepository.php b/backend/CodeRepository.php
index 4b60804..eb90ac4 100644
--- a/backend/CodeRepository.php
+++ b/backend/CodeRepository.php
@@ -188,11 +188,13 @@
*/
public function getAuthorList() {
global $wgMemc;
- $key = wfMemcKey( 'codereview', 'authors', $this->getId() );
+
+ $key = $wgMemc->makeKey( 'codereview', 'authors',
$this->getId() );
$authors = $wgMemc->get( $key );
if ( is_array( $authors ) ) {
return $authors;
}
+
$dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select(
'code_rev',
@@ -205,6 +207,7 @@
'LIMIT' => 500
]
);
+
$authors = [];
foreach ( $res as $row ) {
if ( $row->cr_author !== null ) {
@@ -214,7 +217,9 @@
];
}
}
+
$wgMemc->set( $key, $authors, 3600 * 24 );
+
return $authors;
}
@@ -232,11 +237,13 @@
*/
public function getTagList( $recache = false ) {
global $wgMemc;
- $key = wfMemcKey( 'codereview', 'tags', $this->getId() );
+
+ $key = $wgMemc->makeKey( 'codereview', 'tags', $this->getId() );
$tags = $wgMemc->get( $key );
if ( is_array( $tags ) && !$recache ) {
return $tags;
}
+
$dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select(
'code_tags',
@@ -249,11 +256,14 @@
'LIMIT' => 500
]
);
+
$tags = [];
foreach ( $res as $row ) {
$tags[$row->ct_tag] = $row->revs;
}
+
$wgMemc->set( $key, $tags, 3600 * 3 );
+
return $tags;
}
@@ -355,7 +365,7 @@
// Set up the cache key, which will be used both to check if
already in the
// cache, and to write the final result to the cache.
- $key = wfMemcKey( 'svn', md5( $this->path ), 'diff', $rev1,
$rev2 );
+ $key = $wgMemc->makeKey( 'svn', md5( $this->path ), 'diff',
$rev1, $rev2 );
// If not set to explicitly skip the cache, get the current
diff from memcached
// directly.
diff --git a/backend/RepoStats.php b/backend/RepoStats.php
index 1e9d779..de27b7f 100644
--- a/backend/RepoStats.php
+++ b/backend/RepoStats.php
@@ -25,7 +25,7 @@
public static function newFromRepo( CodeRepository $repo ) {
global $wgMemc, $wgCodeReviewRepoStatsCacheTime;
- $key = wfMemcKey( 'codereview1', 'stats', $repo->getName() );
+ $key = $wgMemc->makeKey( 'codereview1', 'stats',
$repo->getName() );
$stats = $wgMemc->get( $key );
wfDebug( "{$repo->getName()} repo stats: cache " );
if ( $stats ) {
--
To view, visit https://gerrit.wikimedia.org/r/403871
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd174f842230118285b682b03c49ec2a432f7764
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CodeReview
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits