解决java和.NET互相操作memcache差异问题
之前有项目进行java和.NET(Memcached.ClientLibrary)交互时,通过memcache作为通道进行数据交互。
1、顺向操作(.NET插入数据,JAVA读取)时,java会获取多一个前置byte字符,简单过滤后解决;
2、逆向操作(JAVA插入数据,.NET读取)时,竟然发现.NET获取到null,经过走读源代码
发现JAVA发送进去的内容,首字符位是不需要的,而.NET第一个byte字符竟然是识别插入的内容的类型是整形, 字符或者其它对象等
public const byte BoolMarker = 2;
public const byte ByteMarker = 1;
public const byte CharMarker = 5;
public const byte DateTimeMarker = 11;
public const byte DoubleMarker = 10;
public const byte Int16Marker = 9;
public const byte Int32Marker = 3;
public const byte Int64Marker = 4;
public const byte SingleMarker = 8;
public const byte StringBuilderMarker = 7;
public const byte StringMarker = 6;
public const byte ByteMarker = 1;
public const byte CharMarker = 5;
public const byte DateTimeMarker = 11;
public const byte DoubleMarker = 10;
public const byte Int16Marker = 9;
public const byte Int32Marker = 3;
public const byte Int64Marker = 4;
public const byte SingleMarker = 8;
public const byte StringBuilderMarker = 7;
public const byte StringMarker = 6;
仅此记录,避免以后重复掉进同一个坑里边。

浙公网安备 33010602011771号