memcached question: exchanging strings between PHP and C++
I am using memcached to store strings - using a PHP client. I now want to be able to access the same memcached da开发者_如何学Gota using a C++ client. (Race conditions aside), I would like to know:
Is this possible? (I rember reading somewhere that PHP padded strings diffferent when storing them in memcached)
Can I use the strings "as is" in the C++ application without further munging/processing?
Memcached (or anything that speaks the Memcache protocol), doesn't handle typed data. Whatever you associate to a key (and a key itself) is just binary data.
You can get this data and store it as a string in C++ and PHP with no issues if the character set is the same.
But if you need to share more complex structures between C++ and PHP, I would highly recommend serializing it with MessagePack: http://msgpack.org/
精彩评论