Java Xmemcached 或 Spymemcached 客户端无法通过设置的密钥从memcached获取正确的值通过 C# Enyim 客户端。
我们已经尝试将C#MemcachedProtocol.Binary设置为Text来存储基本的String格式数据,但Java Xmemcached客户端和Spymemcached客户端都无法获取数据。错误如下:
2018-01-11 11:08:06.655 [ERROR] [main] BaseSerializingTranscoder: Failed to decompress data
java.util.zip.ZipException: Not in GZIP format
at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:165) ~[?:1.8.0_144]
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:79) ~[?:1.8.0_144]
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:91) ~[?:1.8.0_144]
at net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder.gzipDecompress(BaseSerializingTranscoder.java:274) [xmemcached-2.4.0.jar:?]
at net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder.decompress(BaseSerializingTranscoder.java:219) [xmemcached-2.4.0.jar:?]
at net.rubyeye.xmemcached.transcoders.SerializingTranscoder.decode(SerializingTranscoder.java:87) [xmemcached-2.4.0.jar:?]
at net.rubyeye.xmemcached.XMemcachedClient.fetch0(XMemcachedClient.java:657) [xmemcached-2.4.0.jar:?]
at net.rubyeye.xmemcached.XMemcachedClient.get0(XMemcachedClient.java:1085) [xmemcached-2.4.0.jar:?]
at net.rubyeye.xmemcached.XMemcachedClient.get(XMemcachedClient.java:1043) [xmemcached-2.4.0.jar:?]
at net.rubyeye.xmemcached.XMemcachedClient.get(XMemcachedClient.java:1065) [xmemcached-2.4.0.jar:?]
如果我们使用StringTranscoder(),则错误将解码字符串错误:
Exception in thread "main" java.lang.RuntimeException: Decode String error
at net.rubyeye.xmemcached.transcoders.StringTranscoder.decode(StringTranscoder.java:35)
at net.rubyeye.xmemcached.transcoders.StringTranscoder.decode(StringTranscoder.java:11)
at net.rubyeye.xmemcached.XMemcachedClient.fetch0(XMemcachedClient.java:657)
at net.rubyeye.xmemcached.XMemcachedClient.get0(XMemcachedClient.java:1085)
at net.rubyeye.xmemcached.XMemcachedClient.get(XMemcachedClient.java:1043)
at net.rubyeye.xmemcached.XMemcachedClient.get(XMemcachedClient.java:1065)
答案 0 :(得分:0)
通过编写自定义代码转换器并忽略GZIP / ZIP标记部分来解决问题。