当前位置:网站首页>boundvalueops和opsforvalue区别
boundvalueops和opsforvalue区别
2022-06-27 06:50:00 【玲珑·】
/**获取a,然后获取b,然后删除c,对同一个key有多次操作,按照opsForHash()的写法 * 每次都是redisTemplate.opsForHash().xxx("key","value")写法很是啰嗦 */
int result = (Integer) redisTemplate.opsForHash().get("hash-key","a");
result = (Integer)redisTemplate.opsForHash().get("hash-key","b");
redisTemplate.opsForHash().delete("hash-key","c");
/** * boundHashOps()则是直接将key和boundHashOperations对象进行了绑定, * 后续直接通过boundHashOperations对象进行相关操作即可,写法简洁,不需要 * 每次都显式的将key写出来 */
BoundHashOperations<String, String, Object> boundHashOperations = redisTemplate.boundHashOps("hash-key");
result = (Integer) boundHashOperations.get("a");
result = (Integer) boundHashOperations.get("b");
boundHashOperations.delete("c");
//以上是个人拙见,如有不对,欢迎指正
边栏推荐
猜你喜欢
Park and unpark in unsafe
面试官:用分库分表如何做到永不迁移数据和避免热点问题?
The interviewer of a large front-line factory asked: do you really understand e-commerce order development?
Fast implementation of thread mesh networking
Assembly language - Wang Shuang Chapter 9 Principles of transfer instructions - Notes
Meaning of 0.0.0.0:x
路由器和交换机的区别
Caldera installation and simple use
Win10 remote connection to ECS
用XGBoost迭代读取数据集
随机推荐
pytorch Default process group is not initialized
uview的安装和功能
MySQL
Modeling competition - optical transport network modeling and value evaluation
el-select多个时,el-select筛选选中过的值,第二个el-select中过滤上一个选中的值
(已解决) MINet 进行测试时报错如下 raise NotImplementedError
NoViableAltException([email protected][2389:1: columnNameTypeOrConstraint : ( ( tableConstraint ) | ( columnNameT
Centos7.9 install MySQL 5.7 and set startup
thrift
从5秒优化到1秒,系统飞起来了...
Unsafe中的park和unpark
面试官:你天天用 Lombok,说说它什么原理?我竟然答不上来…
C Primer Plus Chapter 11_ Strings and string functions_ Codes and exercises
快速实现Thread Mesh组网详解
【毕业季】毕业是人生旅途的新开始,你准备好了吗
Memory barrier store buffer, invalid queue
Maxcompute SQL 的查询结果条数受限1W
win10远程连接云服务器
postgreSQL在windows系统遇到权限否认(permission denied)
The number of query results of maxcompute SQL is limited to 1W