当前位置:网站首页>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中是一个对象一行数据!边栏推荐
- 缓存字符流
- Analysis and comparison of mobile cross-end technical solutions
- rpm安装提示error: XXX: not an rpm package (or package manifest):
- 为什么密码云服务平台是云时代的必然之选?
- 七夕疯狂搞钱的年轻人,一周赚14万
- 03 多线程与高并发 - ReentrantLock 源码解析
- Access Huawei game anti-addiction, click the anti-addiction pop-up window, the game crashes
- 用VbScript控制光驱
- 小程序在政务服务平台建设中如何发挥价值
- 跨链桥已成行业最大安全隐患 为什么和怎么办
猜你喜欢

正则表达式

树莓派入门

Small program on how to play in the construction of e-government service platform value

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

罗振宇的A股梦,咋这么难圆?

5 cloud security management strategies enterprises should implement

企业应当实施的5个云安全管理策略

数据中台建设(九):数据中台资产运营机制

Focusing on data sources, data quality and model performance to build a credit profile of small and micro enterprises

接入华为游戏防沉迷,点击防沉迷弹窗后游戏闪退
随机推荐
OAuth2图文快速入门
持续交付(二)PipeLine基本使用
ES 节点2G内存分析
什么是 DevOps?看这一篇就够了!
《独行月球》猛药,治不了开心麻花内耗
一分钟认识 IndexedDB 数据库,太强大了!
接入华为游戏防沉迷,点击防沉迷弹窗后游戏闪退
集群监控——Zabbix
电源测试之输出动态响应(Output Dynamic Response Test)
图像分割方法
Diffusion Models:生成扩散模型
业务中我们如何更新缓存?Redis
【PHP实现微信公众平台开发—基础篇】第1章 课程介绍
RobotFramework二次开发(一)
Do you understand the various configurations in the project?
How to develop small program plug-ins to achieve profitability?
电源输出的Overshoot和Undershoot 测试
形态学(膨胀、腐蚀)
从零开始配置 vim(7)——自动命令
Small program on how to play in the construction of e-government service platform value