ZF-5702: Memcached backend performs set() calls unecessarily
Description
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.
Comments
Posted by Jonathan Owens (niralisse) on 2009-02-05T16:32:05.000+0000
Attaching diff instead.
Posted by Jonathan Owens (niralisse) on 2009-02-05T16:32:30.000+0000
Noting attached rather than inline patch.
Posted by Jonathan Owens (niralisse) on 2009-02-05T16:45:20.000+0000
Improved version that fixes a return bug in touch() and removes another uneccessary add()
Posted by Fabien MARTY (fab) on 2009-02-07T01:35:42.000+0000
just commited something into SVN trunk inspired by your patch
please reopen this issue if it's not ok for you
thanks
Posted by Matthew Ratzloff (mratzloff) on 2009-02-07T08:32:14.000+0000
Shouldn't that should be $newLifetime on line 440?
Posted by Fabien MARTY (fab) on 2009-02-08T00:58:51.000+0000
of course, fixed in SVN trunk