ZF2-135: CLONE - Memcache Semaphore Keys

Issue Type: Improvement Created: 2012-01-09T19:32:09.000+0000 Last Updated: 2012-01-09T19:36:18.000+0000 Status: Closed Fix version(s): Reporter: Marc Bennewitz (private) (mabe) Assignee: Marc Bennewitz (private) (mabe) Tags: - Zend\Cache

Related issues: Attachments:


While using the memcached backend there's no way to specify that a save should not occur if there is already a value in the cache thereby indirectly causing race conditions when adding a semaphore. By implementing an option to specify semaphoreIds this can be avoided.

<pre class="literal">
        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);


Posted by Marc Bennewitz (private) (mabe) on 2012-01-09T19:36:18.000+0000


Now there are the methods defined on interface: - setItem(s) - replace or add one or more items - addItem(s) - only add one or more items - replaceItem(s) - replace one or more existing items

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.