[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Use HashBag instead of EmptyBag

2017-03-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/339330 )

Change subject: Use HashBag instead of EmptyBag
..


Use HashBag instead of EmptyBag

If the local cluster cache is an EmptyBagOfStuff, fall back to a
HashBagOStuff to at least cache for the duration of the request.

Also logs a warning, so we can easily tell on production if we're
only pretending to cache things.

Bug: T128692
Change-Id: I570cdcc7347312bb246848b5d43d22ce1720d3f1
---
M gateway_common/LocalClusterPsr6Cache.php
1 file changed, 17 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Awight: Looks good to me, approved



diff --git a/gateway_common/LocalClusterPsr6Cache.php 
b/gateway_common/LocalClusterPsr6Cache.php
index 30740d8..ed7e32e 100644
--- a/gateway_common/LocalClusterPsr6Cache.php
+++ b/gateway_common/LocalClusterPsr6Cache.php
@@ -11,8 +11,23 @@
  * (no constructor-parameters need to be specified)
  */
 class LocalClusterPsr6Cache extends BagOStuffPsrCache {
+
+   /**
+* @var BagOStuff
+*/
+   protected static $mainCache = null;
+
public function __construct() {
-   $mainCache = ObjectCache::getLocalClusterInstance();
-   parent::__construct( $mainCache );
+   if ( self::$mainCache === null ) {
+   self::$mainCache = 
ObjectCache::getLocalClusterInstance();
+   if ( self::$mainCache instanceof EmptyBagOStuff ) {
+   // FIXME: where does this go?
+   wfLogWarning(
+   'ObjectCache::getLocalClusterInstance() 
returned EmptyBagOStuff, using HashBagOStuff'
+   );
+   self::$mainCache = new HashBagOStuff();
+   }
+   }
+   parent::__construct( self::$mainCache );
}
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/339330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I570cdcc7347312bb246848b5d43d22ce1720d3f1
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 
Gerrit-Reviewer: AndyRussG 
Gerrit-Reviewer: Awight 
Gerrit-Reviewer: Cdentinger 
Gerrit-Reviewer: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: Katie Horn 
Gerrit-Reviewer: Ssmith 
Gerrit-Reviewer: XenoRyet 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Use HashBag instead of EmptyBag

2017-02-22 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/339330 )

Change subject: Use HashBag instead of EmptyBag
..

Use HashBag instead of EmptyBag

If the local cluster cache is an EmptyBagOfStuff, fall back to a
HashBagOStuff to at least cache for the duration of the request.

Change-Id: I570cdcc7347312bb246848b5d43d22ce1720d3f1
---
M gateway_common/LocalClusterPsr6Cache.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/30/339330/1

diff --git a/gateway_common/LocalClusterPsr6Cache.php 
b/gateway_common/LocalClusterPsr6Cache.php
index 30740d8..c307100 100644
--- a/gateway_common/LocalClusterPsr6Cache.php
+++ b/gateway_common/LocalClusterPsr6Cache.php
@@ -13,6 +13,9 @@
 class LocalClusterPsr6Cache extends BagOStuffPsrCache {
public function __construct() {
$mainCache = ObjectCache::getLocalClusterInstance();
+   if ( $mainCache instanceof EmptyBagOStuff ) {
+   $mainCache = new HashBagOStuff();
+   }
parent::__construct( $mainCache );
}
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/339330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I570cdcc7347312bb246848b5d43d22ce1720d3f1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits