Hi,
I've been testing this new memcached extension that uses libmemcached.
The payload flags for compressed and serialized are backwards, the "standard" is for bit 0 to denote serialized and bit 1 to denote compressed, I changed the values in php_memcached.c to:
#define MEMC_VAL_SERIALIZED (1<<0)
#define MEMC_VAL_COMPRESSED (1<<1)
All clients except python seem to agree on this:
http://www.hjp.at/zettel/m/memcached_flags.rxml
I've also made a slight change to libmemcached to make the ketama-hashing support compatible with libketama. I consider this a bug in libmemcached and will send them a patch too. If anyone else needs ketama compatible hashing in this php extension, make this change [1] to libmemcached.
Thanks for releasing this, a php extension using libmemcached is long overdue :)
Regards,
RJ
[1] patch for libmemcached for ketama compatability (always include port in hash-key):
rj@rj ~/libmemcached-0.26
$ diff libmemcached/memcached_hosts.c.orig libmemcached/memcached_hosts.c
160c160
< pointer_per_server= floorf(pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)(ptr->number_of_hosts) + 0.0000000001) * 4;
---
> pointer_per_server= floorf(pct * MEMCACHED_POINTS_PER_SERVER_KETAMA * (float)(ptr->number_of_hosts));
175,185c175,176
< if (list[host_index].port == MEMCACHED_DEFAULT_PORT)
< {
< sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH, "%s-%d",
< list[host_index].hostname, index - 1);
<
< }
< else
< {
< sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH, "%s:%d-%d",
< list[host_index].hostname, list[host_index].port, index - 1);
< }
---
> sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH, "%s:%d-%d",
> list[host_index].hostname, list[host_index].port, index - 1);