ZF-5702: Memcached backend performs set() calls unecessarily


In the memcached backend's save() call, a set() is performed even after it is ensured that the key does not exist. set() is rather slow in memcache, and calling it when an add() will do is only a drag.

Additionally, save() performs a replace() when it's intending to do a set(), and replace() apparently doesn't work on older (<= 1.2.3) versions of memcached.

The attached patch resolves the issue.


Attaching diff instead.

Noting attached rather than inline patch.

Improved version that fixes a return bug in touch() and removes another uneccessary add()

just commited something into SVN trunk inspired by your patch

please reopen this issue if it's not ok for you


Shouldn't that should be $newLifetime on line 440?

of course, fixed in SVN trunk