Redis 返回集合 key 中的所有成员 命令:SMEMBERS

SMEMBERS key

返回集合 key 中的所有成员。

不存在的 key 被视为空集合。

 

可用版本:

>= 1.0.0

 

时间复杂度:

O(N), N 为集合的基数。

 

返回值:

集合中的所有成员。

 

实例:

key 不存在或集合为空

redis> EXISTS not_exists_key

(integer) 0

 

redis> SMEMBERS not_exists_key

(empty list or set)

 

非空集合

redis> SADD language Ruby Python Clojure

(integer) 3

 

redis> SMEMBERS language

1) "Python"

2) "Ruby"

3) "Clojure"

付杰
  • ¥ 59.0元
  • 市场价:99.0元
  • ¥ 199.0元
  • 市场价:299.0元
  • ¥ 99.9元
  • 市场价:299元
  • ¥ 298.0元
  • 市场价:598.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: