redis报错:jedis connection exception unexpected end of stream
生活随笔
收集整理的這篇文章主要介紹了
redis报错:jedis connection exception unexpected end of stream
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一般的話,原因是你在spring中把jedis客戶端配置成了單例模式(singleton),所以當在極短時間內,有多個請求連續發送過來時,jedis就會報錯,說一個連接還沒結束。
所以正確的配置是,將jedis配置成原型模式,每一次注入都產生一個新對象。
<!-- redis客戶端 --><bean name="redis" class="redis.clients.jedis.Jedis" scope="prototype" ><constructor-arg name="host"><value>127.0.0.1</value></constructor-arg><constructor-arg name="port"><value type="int">6379</value></constructor-arg></bean>上面的代碼中,增加了scope="prototype"
參考:
Unexpected end of stream
看 “dbubenheim ”回到部分
總結
以上是生活随笔為你收集整理的redis报错:jedis connection exception unexpected end of stream的全部內容,希望文章能夠幫你解決所遇到的問題。