jenkins-bot has submitted this change and it was merged.
Change subject: Removed useless $wgUseLocalMessageCache check in MessageCache
......................................................................
Removed useless $wgUseLocalMessageCache check in MessageCache
* The localCache member will use CACHE_NONE if this is off,
so the set()/get() calls are already no-oped
* Also allow using the local cache if $hash is false
in "stale mode", which handles the case where the hash
key fell out of memory for some reason more gracefully
Change-Id: Ie12efcd4088a6dc4a4cdd2fd06646f2881df53d7
---
M includes/cache/MessageCache.php
1 file changed, 19 insertions(+), 26 deletions(-)
Approvals:
Ori.livneh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php
index 9aac37a..fef544a 100644
--- a/includes/cache/MessageCache.php
+++ b/includes/cache/MessageCache.php
@@ -190,6 +190,7 @@
*/
protected function getLocalCache( $code ) {
$cacheKey = wfMemcKey( __CLASS__, $code );
+
return $this->localCache->get( $cacheKey );
}
@@ -226,8 +227,6 @@
* @return bool
*/
function load( $code = false, $mode = null ) {
- global $wgUseLocalMessageCache;
-
if ( !is_string( $code ) ) {
# This isn't really nice, so at least make a note about
it and try to
# fall back
@@ -260,25 +259,23 @@
# or local cache goes out of date (e.g. due to replace() on
some other server)
list( $hash, $hashVolatile ) = $this->getValidationHash( $code
);
- if ( $wgUseLocalMessageCache && $hash ) {
- # Try the local cache and check against the cluster
hash key...
- $cache = $this->getLocalCache( $code );
- if ( !$cache ) {
- $where[] = 'local cache is empty';
- } elseif ( !isset( $cache['HASH'] ) || $cache['HASH']
!== $hash ) {
- $where[] = 'local cache has the wrong hash';
- $staleCache = $cache;
- } elseif ( $this->isCacheExpired( $cache ) ) {
- $where[] = 'local cache is expired';
- $staleCache = $cache;
- } elseif ( $hashVolatile ) {
- $where[] = 'local cache validation key is
expired/volatile';
- $staleCache = $cache;
- } else {
- $where[] = 'got from local cache';
- $success = true;
- $this->mCache[$code] = $cache;
- }
+ # Try the local cache and check against the cluster hash key...
+ $cache = $this->getLocalCache( $code );
+ if ( !$cache ) {
+ $where[] = 'local cache is empty';
+ } elseif ( !isset( $cache['HASH'] ) || $cache['HASH'] !== $hash
) {
+ $where[] = 'local cache has the wrong hash';
+ $staleCache = $cache;
+ } elseif ( $this->isCacheExpired( $cache ) ) {
+ $where[] = 'local cache is expired';
+ $staleCache = $cache;
+ } elseif ( $hashVolatile ) {
+ $where[] = 'local cache validation key is
expired/volatile';
+ $staleCache = $cache;
+ } else {
+ $where[] = 'got from local cache';
+ $success = true;
+ $this->mCache[$code] = $cache;
}
if ( !$success ) {
@@ -627,8 +624,6 @@
* @return bool
*/
protected function saveToCaches( $cache, $dest, $code = false ) {
- global $wgUseLocalMessageCache;
-
if ( $dest === 'all' ) {
$cacheKey = wfMemcKey( 'messages', $code );
$success = $this->mMemc->set( $cacheKey, $cache );
@@ -639,9 +634,7 @@
$this->setValidationHash( $code, $cache['HASH'] );
# Save to local cache
- if ( $wgUseLocalMessageCache ) {
- $this->saveToLocalCache( $code, $cache );
- }
+ $this->saveToLocalCache( $code, $cache );
return $success;
}
--
To view, visit https://gerrit.wikimedia.org/r/234458
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie12efcd4088a6dc4a4cdd2fd06646f2881df53d7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits