Sadly, no. I looked for this as well when I implemented our BeITMemcached client, but I saw no common practices whatsoever, so I of course rolled my own, which looks like this: http://code.google.com/p/beitmemcached/source/browse/trunk/ClientLibrary/Serializer.cs
In reality, there are very few people who need inter-client operability, so it's not very high on anyone's radar for implementing it, and those that do need it always have the skill to make their own serializers and flags, and it doesn't make sense for them to contribute back what's essentially just a different flag enumeration, which might not be suitable in the general case. It's also important to remember that you can only really share primitive data between languages, and there is a overhead associated with converting to and from a general form such as JSON or similar. In our client I opted for speed, which means I chose the smallest byte representation of primitive types instead of writing them out as parseable strings, for example. There's an opportunity to standardize with the release of the binary protocol, all it takes is for someone with some knowledge of a bunch of clients to boldly stand up and declare the Way It Will Be, and I think most people will follow. :-) /Henrik On Tue, Jan 13, 2009 at 13:29, Mikael Johansson <[email protected]> wrote: > > Hi, > > Is there any convention for clients to indicate which client side data > type a string value represents (e.g. string, int, bool, ..)? I'm about > to implement this for the pecl/memcache client and it would be nice to > use some common pattern. Could find any specific info on the lists > other than this: > > http://www.hjp.at/zettel/m/memcached_flags.rxml > > The only client here shown to use data types are net.spy.memcached > which uses > > Serialized 0x0001 > Gzip 0x0002 > > String 0x0000 C style string (\0 byte not included)?? > bool 0x0100 Stored as string "0" or "1"? > int 0x0200 32bit int, stored as decimal string, sprintf("%d", > ..)? > long 0x0300 64bit int, stored as decimal string, sprintf("%ld", > ..)? > Date 0x0400 Formatting? E.g. ISO 8601 style, > 2004-02-12T15:19:21+00:00 or simple unix timestamp? > byte 0x0500 Same as unsigned char? > float 0x0600 Stored as decimal string, sprintf("%f", ..)? > double 0x0700 Stored as decimal string, sprintf("%f", ..)? > Bytearray 0x0800 Binary string? > > It there anyone else who have implemented this sort of functionality > using other flags or formatting? > > //Mikael
