Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Get the number of members in a set
await redis.scard(key);
0
await redis.sadd("myset", "hello", "world", "foo"); const size = await redis.scard("myset"); console.log(size); // 3
const size = await redis.scard("nonexistent"); console.log(size); // 0
await redis.sadd("sessions:active", "session1", "session2", "session3"); const activeCount = await redis.scard("sessions:active"); console.log(`Active sessions: ${activeCount}`); // Active sessions: 3
await redis.sadd("tags", "javascript", "typescript"); console.log(await redis.scard("tags")); // 2 await redis.sadd("tags", "python", "go"); console.log(await redis.scard("tags")); // 4 await redis.srem("tags", "javascript"); console.log(await redis.scard("tags")); // 3