Просмотр исходного кода

ZF-8856: reverted changes of save() of ZF-5702: The add command isn't faster because it needs a second request if cache already exist and a memcached bug on replacing items couldn't be reproduced

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20590 44c647ce-9c0f-0410-b52a-842ac1e357ba
mabe 16 лет назад
Родитель
Сommit
6981f62463
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      library/Zend/Cache/Backend/Memcached.php

+ 5 - 4
library/Zend/Cache/Backend/Memcached.php

@@ -219,13 +219,14 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
         } else {
             $flag = 0;
         }
-        // #ZF-5702 : we try add() first becase set() seems to be slower
-        if (!($result = $this->_memcache->add($id, array($data, time(), $lifetime), $flag, $lifetime))) {
-            $result = $this->_memcache->set($id, array($data, time(), $lifetime), $flag, $lifetime);
-        }
+
+        // ZF-8856: using set because add needs a second request if item already exists
+        $result = @$this->_memcache->set($id, array($data, time(), $lifetime), $flag, $lifetime);
+
         if (count($tags) > 0) {
             $this->_log("Zend_Cache_Backend_Memcached::save() : tags are unsupported by the Memcached backend");
         }
+
         return $result;
     }