記錄一下,都配置好了以後,用java客戶端設置key-value,在服務器get沒有問題,而後再服務器端設置一個key-value,java客戶端獲取出錯java
轉載一下網上一樣問題的描述,以及解決方案緩存
嚴重: ++++ exception thrown while trying to get object from cache for key: test1
2013-6-26 23:18:37 com.schooner.MemCached.AscIIClient get
嚴重: invalid stream header: 6675636B
java.io.StreamCorruptedException: invalid stream header: 6675636B
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at com.schooner.MemCached.ObjectTransCoder.decode(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.schooner.MemCached.AscIIClient.get(Unknown Source)
at com.danga.MemCached.MemCachedClient.get(Unknown Source)
at com.libo.memcache.MemcachedCli.get(MemcachedCli.java:39)
at com.libo.memcache.MCTest.main(MCTest.java:17)
在網上查緣由發現
在memcached中,不一樣的客戶端在set或者add值時,對命令的第二個參數的使用是不一致的
<command name> <key> <flags> <exptime> <bytes>
< data block>
JAVA客戶端flags字段填寫的都是32,不是32的是沒法經過java客戶端get出來的
因此在經過memcached admin進行數據set時,須要顯示指定flags值爲32
set testkey 32 0 5
12345
如此放入緩存後,經過java客戶端是能夠取出來的。 服務器