Overall
SDKs
- Typescript
- @upstash/redis
- Overview
- Get Started
- Commands
- Overview
- Auth
- Bitmap
- Generic
- Hash
- Json
- List
- PubSub
- Scripts
- Server
- Set
- Sorted Set
- Stream
- String
- Transactions
- Deployment
- Pipeline
- Advanced
- Retries
- Troubleshooting
- Developing or Testing
- @upstash/query
- @upstash/vector
- @upstash/edge-flags
- @upstash/ratelimit
- @upstash/kafka
- @upstash/qstash
- Python
DevOps
- Terraform
- Pulumi
- CLI
Set
SCARD
Return how many members are in a set
await redis.sadd("key", "a", "b", "c");
const cardinality = await redis.scard("key");
console.log(cardinality); // 3
Arguments
The key of the set.
Response
How many members are in the set.
await redis.sadd("key", "a", "b", "c");
const cardinality = await redis.scard("key");
console.log(cardinality); // 3
Was this page helpful?
await redis.sadd("key", "a", "b", "c");
const cardinality = await redis.scard("key");
console.log(cardinality); // 3