博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用Redis集
阅读量:2506 次
发布时间:2019-05-11

本文共 1121 字,大约阅读时间需要 3 分钟。

Sets have 2 main differences with lists:

集与列表有2个主要区别:

  1. sets are not ordered

    套装不订购
  2. sets only hold an item once

    设置只容纳一次

Create a set using

使用创建一个集

SADD <setkey> <value>

SADD <setkey> <value>

The same command is used to add more items to the set.

使用相同的命令将更多项目添加到集合中。

Example:

例:

SADD names "Flavio"SADD names "Roger"SADD names "Tony" "Mark" "Jane"

Get all the items in a set using SMEMBERS <setkey>:

使用SMEMBERS <setkey>获取集合中的所有项目:

Find out if a value is in a set with SISMEMBER:

SISMEMBER找出一个值是否在集合中:

SISMEMBER names "Flavio"

To know how many items are in a set, use SCARD:

要知道一组中有多少项,请使用SCARD

SCARD names

Get (without removing) an item from the set, randomly:

从集合中随机获取(不删除)项目:

SRANDMEMBER names

Extract (and remove) an item from the set, casually ordered:

从集合中提取(并删除)一个项目,随意排序:

SPOP names

You can extract multiple items at once:

您可以一次提取多个项目:

SPOP names 2

Remove an item from a set by value:

从值集中删除一个项目:

SREM names "Flavio"

Get the items contained in 2 different sets, exclusing elements only included in one with SINTER:

获取包含在2套不同的项目,exclusing仅包含在一个与元素SINTER

SINTER set1 set2

See all the sets commands .

查看所有set命令。

翻译自:

转载地址:http://wxmgb.baihongyu.com/

你可能感兴趣的文章
Chapter 3 Phenomenon——9
查看>>
win64 Python下安装PIL出错解决2.7版本 (3.6版本可以使用)
查看>>
获取各种类型的节点
查看>>
表达式求值-201308081712.txt
查看>>
centos中安装tomcat6
查看>>
从Vue.js窥探前端行业
查看>>
学习进度
查看>>
poj3368 RMQ
查看>>
“此人不存在”
查看>>
github.com加速节点
查看>>
解密zend-PHP凤凰源码程序
查看>>
python3 序列分片记录
查看>>
Atitit.git的存储结构and 追踪
查看>>
atitit 读书与获取知识资料的attilax的总结.docx
查看>>
B站 React教程笔记day2(3)React-Redux
查看>>
找了一个api管理工具
查看>>
C++——string类和标准模板库
查看>>
zt C++ list 类学习笔记
查看>>
git常用命令
查看>>
探讨和比较Java和_NET的序列化_Serialization_框架
查看>>