SCARD

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Return the number of members in a key

Usage: scard key.
You can also use SLEN.

Example

Command>sadd myset "member_1" "member_2"
Result>2
Command>sadd myset "member_3" "member_4"
Result>2
Command>scard myset
Result>4


Syntax

SCARD key

  • Available since version 1.0.0.
  • Time complexity is O(1).
Related commands SISMEMBER, LLEN, ZCARD
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< SLS SCARD SUNION >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.