PHP Client ComparisonThere are primarily two clients used with PHP. One is the older, more widespread pecl/memcache and the other is the newer, less used, more feature rich pecl/memcached. Both support the basics such as multiple servers, setting vaules, getting values, increment, decrement and getting stats. Here are some more advanced features and information.
| |
pecl/memcache |
pecl/memcached |
| First Release Date |
2004-06-08 |
2009-01-29 (beta) |
| Actively Developed? |
Yes |
Yes |
| External Dependency |
None |
libmemcached |
| Features |
| Automatic Key Fixup1 |
Yes |
No |
| Append/Prepend |
No |
Yes |
| Automatic Serialzation2 |
Yes |
Yes |
| Binary Protocol |
No |
Optional |
| CAS |
No |
Yes |
| Compression |
Yes |
Yes |
| Communication Timeout |
Connect Only |
Various Options |
| Consistent Hashing |
Yes |
Yes |
| Delayed Get |
No |
Yes |
| Multi-Get |
Yes |
Yes |
| Session Support |
Yes |
Yes |
| Set/Get to a specific server |
No |
Yes |
| Stores Numerics |
Converted to Strings |
Yes |
- pecl/memcache will convert an invalid key into a valid key for you. pecl/memcached will return false when trying to set/get a key that is not valid.
- You do not have to serialize your objects or arrays before sending them to the set commands. Both clients will do this for you.
|
I would put in ability to set to multiple servers - I know pecl/memcache supports that. Basically like setting copies=2 in ZFS.
I would also like to see a link as to what the append/prepend is. If it is what I think it is, it's almost worth a switch for me immediately!
Is connection pooling handled differently between the two? I know with pecl/memcache, connection pooling happens on a per-apache-instance basis. With pecl/memcached, is it the same, or does it happen at a different level?
Is there any failover mechnism in PECL/Memcached. What I want is if any server in my pools goes down, the client should get data from other servers (I m using repcached servers)
pecl/memcached does not support failover or persistent connections. This is quite annoying, since I'm sure the underlying libmemcached C library supports both.
pecl/memcache does not have the very handy getServerByKey() method, which is immensely useful when debugging.
Is pecl/memcache still being developed? There's been no new version since Feb 09 and the latest beta has a few show stopping bugs (the only version that works with the binary protocol).