Redis 中的 SINTERSTORE命令函数

首页 / Redis入门教程 / Redis 中的 SINTERSTORE命令函数

Redis SINTERSTORE 命令在所有指定集合相交之后将元素存储在集合中,不存在的键被认为是空集,如果其中一个键为空集,则输出集也为空。

SINTERSTORE - 返回值

返回元素数量。

SINTERSTORE - 语法

以下是Redis SINTERSTORE 命令的基本语法。

redis 127.0.0.1:6379> SINTERSTORE DESTINATION_KEY KEY KEY1..KEYN

SINTERSTORE - 示例

redis 127.0.0.1:6379> SADD myset1 "hello" 
(integer) 1 
redis 127.0.0.1:6379> SADD myset1 "foo" 
(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 "Learnfk" 
(integer) 1 
redis 127.0.0.1:6379> SINTERSTORE myset myset1 myset2 
(integer) 1 
redis 127.0.0.1:6379> SMEMBERS myset 
1) "hello" 

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

深入浅出区块链 -〔陈浩〕

重学前端 -〔程劭非(winter)〕

互联网人的英语私教课 -〔陈亦峰〕

Django快速开发实战 -〔吕召刚〕

成为AI产品经理 -〔刘海丰〕

高楼的性能工程实战课 -〔高楼〕

操作系统实战45讲 -〔彭东〕

深入剖析Java新特性 -〔范学雷〕

React Native 新架构实战课 -〔蒋宏伟〕

好记忆不如烂笔头。留下您的足迹吧 :)