开发者

memcached question: exchanging strings between PHP and C++

开发者 https://www.devze.com 2023-02-13 07:40 出处:网络
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:

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

精彩评论

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