HLEN

Syntax

  1. HLEN key

Time complexity: O(1)

Returns the number of fields contained in the hash stored at key.

Return

Integer reply: number of fields in the hash, or 0 when key does not exist.

Examples

  1. dragonfly> HSET myhash field1 "Hello"
  2. (integer) 1
  3. dragonfly> HSET myhash field2 "World"
  4. (integer) 1
  5. dragonfly> HLEN myhash
  6. (integer) 2