开发者

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:

  1. Is this possible? (I rember reading somewhere that PHP padded strings diffferent when storing them in memcached)

  2. 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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜