Redis SUNION 命令用于获取并集元素,不存在的键被认为是空集。
返回数组,列出并集的元素。
链接:https://www.learnfk.comhttps://www.learnfk.com/redis/sets-sunion.html
来源:LearnFk无涯教程网
以下是Redis SUNION 命令的基本语法。
redis 127.0.0.1:6379> SUNION KEY KEY1..KEYN
redis 127.0.0.1:6379> SADD myset1 "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset1 "Learnfk" (integer) 1 redis 127.0.0.1:6379> SADD myset1 "bar" (integer) 1 redis 127.0.0.1:6379> SADD myset2 "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset2 "bar" (integer) 1 redis 127.0.0.1:6379> SUNION myset1 myset2 1) "bar" 2) "Learnfk" 3) "hello" 4) "foo"
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)
Spring Cloud 微服务项目实战 -〔姚秋辰(姚半仙)〕