文章詳情頁
為什么redis中incr一個“0” 會報錯?
瀏覽:107日期:2024-07-09 14:21:08
問題描述
問下 弄過redis的人 為什么incr命令會報錯。。“0”可以轉換為 0 呀。
redis 版本是windows 3.2.100 穩定版
問題解答
回答1:我這邊也是正常的
127.0.0.1:6379> set test '0'OK127.0.0.1:6379> INCR test(integer) 1127.0.0.1:6379> INCR test(integer) 2127.0.0.1:6379> INCR test(integer) 3127.0.0.1:6379> get test'3'127.0.0.1:6379> type teststring
版本是redis-3.2.4
回答2:incr
# 情況3:key不是數字值redis> SET book 'long long ago...'OKredis> INCRBY book 200(error) ERR value is not an integer or out of range
不知道你的版本是多少,我版本redis_version:2.4.10 測試沒問題的,在線測試鏈接
回答3:ServiceStack.Redis 客戶端 的確是為string類型的值省略了“”。如果額外加上“” 反而弄巧成拙了! 另外多謝 @蘇生不惑 @mylxsw
相關文章:
1. javascript - 在 model里定義的 引用表模型時,model為undefined。2. css3 - 這個右下角折角用css怎么畫出來?3. javascript - canvas 裁剪空白區域4. atom開始輸入!然后按tab只有空格出現沒有html格式出現5. css3 - 沒明白盒子的height隨width的變化這段css是怎樣實現的?6. java - 我設置了cookie的max age,但是cookie依然在關閉游覽器后消失了7. apache - 想把之前寫的單機版 windows 軟件改成網絡版,讓每個用戶可以注冊并登錄。類似 qq 的登陸,怎么架設服務器呢?8. android - 課程表點擊后浮動后邊透明可以左右滑動的界面是什么?9. python3.x - c++調用python310. java - 根據月份查詢多個表里的內容怎么實現好?
排行榜
