HLEN

AttentionThis page documents an earlier version. Go to the latest (v2.1)version.

Synopsis

HLEN keyThis command fetches the number of fields in the hash that is associated with the given key.

  • If the key does not exist, 0 is returned.
  • If the key is associated with non-hash data, an error is raised.

Return Value

Returns number of fields in the specified hash.

Examples

You can do this as shown below.

  1. $ HSET yugahash area1 "Africa"
  1. 1
  1. $ HSET yugahash area2 "America"
  1. 1
  1. $ HLEN yugahash
  1. 2

See Also

hdel, hexists, hget, hgetall, hkeys, hmget, hmset, hset, hincrby, hstrlen, hvals