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

Issue Type: Improvement Created: 2009-02-05T16:31:12.000+0000 Last Updated: 2010-01-22T11:24:18.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Jonathan Owens (niralisse) Assignee: Fabien MARTY (fab) Tags: - Zend_Cache

Related issues: - ZF-8856

Attachments: - zf-5702.diff


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.


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


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

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.