*** ./Memcached.php	2010-05-20 18:59:02.000000000 +0200
--- /var/www/ZendFramework-1.10.6/library/Zend/Cache/Backend/Memcached.php	2010-07-02 16:34:00.293115262 +0200
***************
*** 86,91 ****
--- 86,94 ----
       * =====> (boolean) compatibility :
       * true if you use old memcache server or extension
       *
+      * =====> (array) semaphoreIds :
+      * an array of ids ; each id representing an id for which add should be run instead of set when save is called
+      *
       * @var array available options
       */
      protected $_options = array(
***************
*** 101,106 ****
--- 104,110 ----
          )),
          'compression' => false,
          'compatibility' => false,
+         'semaphoreIds' => array(),
      );
  
      /**
***************
*** 220,227 ****
              $flag = 0;
          }
  
!         // 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(self::TAGS_UNSUPPORTED_BY_SAVE_OF_MEMCACHED_BACKEND);
--- 224,236 ----
              $flag = 0;
          }
  
!         // ZF-10097: set instead of add when there's an entry in semaphoreIds
!         if (!(array_key_exists($id, $this->_options['semaphoreIds']))) {
!             // 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);
!         } else {
!             $result = $this->_memcache->add($id, array($data, time(), $lifetime), $flag, $lifetime);
!         }
  
          if (count($tags) > 0) {
              $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_MEMCACHED_BACKEND);

