redis cache: prevent "member function on a non-object" problems
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 1 Mar 2016 14:55:41 +0000 (15:55 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 1 Mar 2016 21:27:36 +0000 (22:27 +0100)
... if Redis server has gone away

Change-Id: I1cb564b5b120628ddf18c5eee8a9243f2afdb8d6
Reviewed-on: http://gerrit.tine20.com/customers/2834
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/library/zf1ext/Zend/Cache/Backend/Redis.php

index 458fb86..339ded4 100644 (file)
@@ -187,6 +187,11 @@ class Zend_Cache_Backend_Redis extends Zend_Cache_Backend implements Zend_Cache_
         $lifetime = $this->getLifetime($specificLifetime);
         
         $transaction = $this->_redis->multi();
+
+        if (! $transaction) {
+            $this->_log("Zend_Cache_Backend_Redis::save() : problem with Redis multi-transaction during save");
+            return false;
+        }
         
         if ($lifetime) {
             $transaction->setex($id, $lifetime, array($data, time(), $lifetime, (array)$tags));