当前位置:网站首页>redisTemplate存取List遇到的坑
redisTemplate存取List遇到的坑
2022-08-04 12:35:00 【susu1083018911】
一直以为,存集合元素,会用到:
底层:
@Nullable
Long rightPushAll(K paramK, Collection<V> paramCollection);
我们使用方式:
redisTemplate.opsForList().rightPushAll(key, ids);
使用这种方式,结果redis中,会把真个list作为一行数据存进去,不是我们想要的!
改成如下方式:
redisTemplate.opsForList().rightPushAll(key, list.toArray());
底层调用:
@Nullable
Long rightPushAll(K paramK, V... paramVarArgs);
记得存的时候list.toArray一下,这样存入redis中是一个对象一行数据!边栏推荐
猜你喜欢

跨链桥已成行业最大安全隐患 为什么和怎么办

“蔚来杯“2022牛客暑期多校训练营5 B、C、F、G、H、K

How to develop small program plug-ins to achieve profitability?

移动跨端技术方案分析对比

Hit the interview!The latest interview booklet of Ali Jin, nine silver and ten is stable!

Motion Rule (16)-Union Check Basic Questions-Grid Game

炫酷又高效的数据可视化大屏,做起来真的没那么难!丨极客星球

Analysis and comparison of mobile cross-end technical solutions

聪明的儿子处理婆媳关系的方法(处理婆媳关系的方法)

企业应当实施的5个云安全管理策略
随机推荐
什么是 DevOps?看这一篇就够了!
oracle sql中根据条件判断是否插入数据
Motion Rule (16)-Union Check Basic Questions-Relations
两个数组中用第二个数组的Value对比换第一个数组中的Key
【黑马早报】尚乘数科上市13天,市值超阿里;北大终止陈春花聘用合同;新东方花近200亿退学费和遣散费;张小泉75%产品贴牌代工...
【UML】信息系统分析与设计知识点总结
ShanDong Multi-University Training #4 A、B、C、G
exness:美联储重现鹰派口吻,黄金承压面临转跌信号
电源输出的Overshoot和Undershoot 测试
云原生Devops 的实现方法
Two years of independent development experience Programmers tell us the experience of making money (listen to the masters who really make money)
倒计时 3 天|一起看云原生 Meetup 的六大议题
1314元的七夕礼盒,收割了多少直男?
Nacos手摸手教学【二】Nacos注册中心
OAuth2图文快速入门
MySQL必知必会(初级篇)
动规(16)-并查集基础题——亲戚(Relations)
“蔚来杯“2022牛客暑期多校训练营2 G、J、K
Cache character stream
七夕疯狂搞钱的年轻人,一周赚14万