English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis scard command returns the number of elements in the set.
The basic syntax of the redis scard command is as follows:
redis 127.0.0.1:6379> SCARD KEY_NAME
>= 1.0.0
The number of elements in the set. Returns 0 when the set key does not exist.
redis 127.0.0.1:6379> SADD myset "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset "foo" (integer) 1 redis 127.0.0.1:6379> SADD myset "hello" (integer) 0 redis 127.0.0.1:6379> SCARD myset (integer) 2