問題描述使用管道流批量添加數(shù)據(jù)時(shí),怎么能保證全部添加成功,怎樣才能知道哪些數(shù)據(jù)添加成功了,哪些數(shù)據(jù)添加失敗了問題出現(xiàn)的環(huán)境背景及自己嘗試過哪些方法第一次添加返回值為[1,1,1,1,1,1,1,1........]第二次添加返回值為[2,2,2,2,2,2,2,2........]并不能知道其中添加的具體情況相關(guān)代碼//請把代碼文本粘貼到下方(請勿用圖片代替代碼)//批量增加redis手動領(lǐng)取紅包批量添加publicListpatchAdd(Mapparams){//返回[1,true,1,true]1數(shù)據(jù)在list中的位置設(shè)置過期時(shí)間才會返回true和falseListreturnAll=redisTemplate.executePipelined(newSessionCallback(){@OverridepublicObjectexecute(RedisOperationsredisOperations)throwsDataAccessException{Setentries=params.entrySet();for(Map.Entryparam:entries){Stringkey=param.getKey();Listvalue=param.getValue();lSet(key,value);//過期時(shí)間以秒為單位}returnnull;}});returnreturnAll;}publicbooleanlSet(Stringkey,Listvalue){try{redisTemplate.opsForList().rightPushAll(key,value);returntrue;}catch(Exceptione){e.printStackTrace();returnfalse;}}你期待的結(jié)果是什么?實(shí)際看到的錯(cuò)誤信息又是什么?
跪求!小弟在使用redis的管道流中碰到個(gè)問題,批量添加數(shù)據(jù)的反饋結(jié)果不能知道
慕森王
2019-09-19 13:29:28