Redis Hash: HLEN
HLEN key
Redis HLEN command is used to get the number of fields contained in the hash stored at key.
Syntax:
HLEN KEY_NAME
Available since
2.0.0.
Return Value
Integer reply, the number of fields in the hash, or 0 when a key does not exist.
Return Value Type
Integer
Example: HLEN
127.0.0.1:6379> HSET langhash lang1 "PHP" (integer) 1 127.0.0.1:6379> HSET langhash lang2 "Javascript" (integer) 1 127.0.0.1:6379> HSET langhash lang3 "Python" (integer) 1 127.0.0.1:6379> HSET langhash lang4 "Golanguage" (integer) 1 127.0.0.1:6379> HLEN langhash (integer) 4
Example: Redis HLEN another example
127.0.0.1:6379> HMSET user-x name Sweaty gender Female lang English OK 127.0.0.1:6379> HLEN user-x (integer) 3
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework