What's the easiest way to getting the number (count) of items in Redis set? Preferably without the need to dump whole set and count the lines… So far, I have found only BITCOUNT, which I have not found that useful…
Number of items in Redis set
countredisset
Related Topic
- Python – How to count the number of files in a directory using Python
- How to atomically delete keys matching a pattern using Redis
- Windows – How to run Redis on Windows
- How to delete everything in Redis
- Php – How to set password for Redis
- Print number of keys in Redis
- MISCONF Redis is configured to save RDB snapshots
Best Answer
The SCARD command returns the cardinality (i.e. number of items) of a Redis set.
http://redis.io/commands/scard
There is a similar command (ZCARD) for sorted sets.