ZF-10560: Add 'memcached' Support to Zend_Cache_Backend

Description

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.

Comments

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

Please apply patch or what changes you need ;)

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 -> http://framework.zend.com/wiki/display/…

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.

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.

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

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

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

changed - thanks

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.

adding logging

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

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.

merged to 1.11 branch in r23154

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