From 6147de1182101903cf24259d61ec6ea34b907bf3 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Wed, 12 Aug 2015 21:40:49 -0700 Subject: [PATCH] MessageCache: derive the hash from the cache contents Follow-up for I020617d, where I got this wrong. It is probable that multiple application servers will try to build a local cache at the same time, in which case they will cause the cache key to thrash. It is necessary that two application servers building a local cache from the database generate the same hash for a given set of messages. Change-Id: Ieeefc2094a83be9401c466bec859c1588ddfbcdf --- includes/cache/MessageCache.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 304c4f2192..3f60d8c0c5 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -530,7 +530,8 @@ class MessageCache { } $cache['VERSION'] = MSG_CACHE_VERSION; - $cache['HASH'] = wfRandomString( 8 ); + ksort( $cache ); + $cache['HASH'] = md5( serialize( $cache ) ); $cache['EXPIRY'] = wfTimestamp( TS_MW, time() + $this->mExpiry ); return $cache; -- 2.20.1