I store objects using hashes in Redis, and I would like to calculate the length of these hashes in terms of Redis.
You can do this easily for strings using STRLEN .
But I just can't find a suitable command for hash data in the documentation . This seems to be the same thing for lists or sets.
Basically, the only solution I found was to get the entire hash with HGETALL and calculate the length to fit the client.
Is something completely out of the box?
If I am mistaken, please do not explain why or give me the appropriate SO links / messages / questions.
Edit :
HLEN is not a solution because it "returns the number of fields contained in the hash." I want to calculate this size for capacity planning and active monitoring in a Redis database.
source share