ZF-10560: Add 'memcached' Support to Zend_Cache_Backend

Issue Type: Improvement Created: 2010-10-15T09:09:48.000+0000 Last Updated: 2010-10-18T10:44:04.000+0000 Status: Resolved Fix version(s): - 1.11.1 (30/Nov/10)

Reporter: Mike Willbanks (digitalstruct) Assignee: Marc Bennewitz (private) (mabe) Tags: - Zend_Cache

Related issues: Attachments: - memcached2.patch


Zend_Cache_Backend does not support Memcached from the 'memcached' extension side. This has been brought up several times, however, I have one called "Memcached2" that provides the memcached extension availability. This was somewhat forked from the current Zend_Cache_Backend_Memcached, with some slight modifications to support what Memcached does.

This has the same tests that the current Zend_Cache_Backend_Memcached does and passes all of them.

Attached is the patch file.


Posted by Mike Willbanks (digitalstruct) on 2010-10-15T09:11:46.000+0000

Patch for Memcached2.

Changes: M tests/TestConfiguration.php.dist M tests/Zend/Cache/SkipTests.php M tests/Zend/Cache/AllTests.php A tests/Zend/Cache/Memcached2BackendTest.php A library/Zend/Cache/Backend/Memcached2.php

Posted by Mike Willbanks (digitalstruct) on 2010-10-15T09:12:29.000+0000

Please apply patch or what changes you need ;)

Posted by Marc Bennewitz (private) (mabe) on 2010-10-15T09:48:19.000+0000

Thanks for your patch but this is a new backend and would need a proposal. Additionally 1.11 beta is released and therefore no new features will get in.

The current refactoring of the cache component for zf2 contains an adapter for ext/memcached ->…

Posted by Matthew Weier O'Phinney (matthew) on 2010-10-15T10:07:54.000+0000

Marc -- adapters can come in as feature improvements in the tracker, so long as they are straight-forward. (This differs from the policy for filters, as they operate standalone.) Also, while we are technically in beta, our concept of beta is fairly fluid; we allow minor feature additions so long as they create new functionality and do not change existing functionality, and are trivial in scope.

How different is the attached adapter from what you've done for ZF2? If the differences are minimal or non-existent, I can see use cases for having this in the 1.X series.

Posted by Marc Bennewitz (private) (mabe) on 2010-10-15T10:49:55.000+0000

metthew - this differs from last upgrade to 1.10 there was an alpha before ;) OK than I'll review and commit it this weekend but the name "Memcached2" seems improper to me. The other backend "Memcached" based on ext/memcache is blocking the name but ext/memcached is based on libmemcached and I would like to name it "Libmemcached" until zf2 - that do you think ?.

ps: Zend Cache 2 has a complete different structure and comparing isn't simply possible.

Posted by Mike Willbanks (digitalstruct) on 2010-10-15T11:09:19.000+0000

That name would likely be better ;)
/me kicks current Memcached for being named evil.

Posted by Marc Bennewitz (private) (mabe) on 2010-10-16T08:30:01.000+0000

Commited your patch in r23136 (trunk) with some changes: - renamed to Libmemcached - added logging on failed calls of set - removed memcached option constants - changed client config to allow constant values of Memcached::OPT_* and override default Memcached configuration on constructor

Please take a look into it - Thanks

Posted by Kazusuke Sasezaki (sasezaki) on 2010-10-16T09:35:59.000+0000

r23136 Libmemcached.php Copyright is "2005-2008" ;)

Posted by Marc Bennewitz (private) (mabe) on 2010-10-16T09:45:40.000+0000

changed - thanks

Posted by Mike Willbanks (digitalstruct) on 2010-10-16T10:17:58.000+0000

r23136 - Libmemcached.php

Constructor: If the client option is not found in the else condition during the constructor, it should either raise an exception or log a message. This is really while it is looking for the client constant option. Also when setting the client option it will return true or false, we could also add logging to that.

Not really absolutely needed but could be added to give the developer a better idea if something is going wrong.

Really like the way you implemented the client options.

Posted by Marc Bennewitz (private) (mabe) on 2010-10-16T19:14:52.000+0000

adding logging

Additionally if I remove the sleep(1) on tests tearDown() all tests passed on my test machine. -> Is that really needed ?

Posted by Mike Willbanks (digitalstruct) on 2010-10-16T19:31:08.000+0000

I don't really think it is needed. With the tests I started off with the same tests that were contained in the current memcached class and started to extend them. Since that one had a sleep(1) i kept it in since I didn't know if there was a CI server that would have required it.

Posted by Marc Bennewitz (private) (mabe) on 2010-10-18T10:43:20.000+0000

merged to 1.11 branch in r23154

  • I leave the sleep(1) on tearDown()

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.