EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/286184

Change subject: Make it easier to turn guzzle cache on/off
......................................................................

Make it easier to turn guzzle cache on/off

Change-Id: Ib5ad2b501a581a8b942fff7c4878267906160d4c
---
M app.php
1 file changed, 15 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/discernatron 
refs/changes/84/286184/1

diff --git a/app.php b/app.php
index 5082e38..6b4334e 100644
--- a/app.php
+++ b/app.php
@@ -41,18 +41,22 @@
     'translator.domains' => array(),
 ));
 
-$app['guzzle'] = function () {
+$app['guzzle.cache'] = true;
+$app['guzzle'] = function () use ($app) {
     $stack = new GuzzleHttp\HandlerStack(GuzzleHttp\choose_handler());
-    // cache requests for 24 hours, makes debugging easier without repeatedly
-    // hitting the search engines and getting blocked
-    $stack->push(new Kevinrob\GuzzleCache\CacheMiddleware(
-        new Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy(
-            new Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage(
-                new 
Doctrine\Common\Cache\FilesystemCache(__DIR__.'/cache/guzzle')
-            ),
-            24 * 60 * 60
-        )
-    ));
+
+       if ($app['guzzle.cache']) {
+           // cache requests for 24 hours, makes debugging easier without 
repeatedly
+           // hitting the search engines and getting blocked
+           $stack->push(new Kevinrob\GuzzleCache\CacheMiddleware(
+               new Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy(
+                   new Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage(
+                       new 
Doctrine\Common\Cache\FilesystemCache(__DIR__.'/cache/guzzle')
+                   ),
+                   24 * 60 * 60
+               )
+           ));
+       }
 
     return new GuzzleHttp\Client([
         'timeout' => 2.0,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5ad2b501a581a8b942fff7c4878267906160d4c
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/discernatron
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

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

Reply via email to