Reputation: 16441
I'm in the process of switching applications from PHP PECL-Memcache client to PECL-Memcached and I'm hitting a snag.
It seems that if I set an INT value from PECL-Memcached that PECL-Memcache can't read it. I see something like:
MemcachePool::get(): Failed to unserialize data
If I cast the int values to a string, get operations work with memcache. Of course, this breaks increment/decrement.
Setting INTs from memcache and reading from memcached works fine.
I'm using:
I suspect it has something to do with the flags the different libraries are setting. Any suggestions on making these compatible with each other?
Thanks!
Upvotes: 1
Views: 906
Reputation: 31
there is incompatibility between pecl-memcache and php-pecl-memcacheD in types of values when flagged in memcached server.
pecl-memcache (memcache_pool.h) uses following flags:
#define MMC_TYPE_STRING 0x0000
#define MMC_TYPE_BOOL 0x0100
#define MMC_TYPE_LONG 0x0300
#define MMC_TYPE_DOUBLE 0x0700
when pecl-memcacheD uses this (php_memcached.c):
#define MEMC_VAL_IS_STRING 0
#define MEMC_VAL_IS_LONG 1
#define MEMC_VAL_IS_DOUBLE 2
#define MEMC_VAL_IS_BOOL 3
#define MEMC_VAL_IS_SERIALIZED 4
#define MEMC_VAL_IS_IGBINARY 5
#define MEMC_VAL_IS_JSON 6
so only type for STRING matches actually and can be decoded in same way by both
Upvotes: 3