当前位置:网站首页>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中是一个对象一行数据!边栏推荐
猜你喜欢
随机推荐
直击面试!阿里金九银十最新面试小册 稳过!
企业应当实施的5个云安全管理策略
Motion Rule (16)-Union Check Basic Questions-Relations
TensorFlow学习记录(三):高阶操作 & 神经网络与全连接层
电源输出的Overshoot和Undershoot 测试
Matlab记录
缓存字符流
Control CD-ROM with VbScript
du命令_set命令选项
博尔赫斯-诗中的经典语段
Escape character is ‘^]’什么意思?怎么使用telnet
分布式链路追踪Jaeger + 微服务Pig在Rainbond上的实践分享
String是引用类型
云原生Devops 的实现方法
考研数一数二数三之间的具体详细区别
形态学(膨胀、腐蚀)
MySQL - Explain explanation
程序猿七夕礼物-如何30分钟给女友快速搭建专属语聊房
What is DevOps?Enough to read this one!
Cool and efficient data visualization big screen, it's really not that difficult to do!丨Geek Planet









