Latest web development tutorials

comando Redis HLEN

Redis hash (hash)

Redis comando HLEN viene utilizzato per ottenere il numero di campi nella tabella hash.

grammatica

Redis HLEN sintassi dei comandi di base è la seguente:

redis 127.0.0.1:6379> HLEN KEY_NAME 

versioni disponibili

> = 2.0.0

Valore di ritorno

Il numero di campi nella tabella hash. Quando la chiave non esiste, viene restituito 0.

Esempi

redis 127.0.0.1:6379> HSET myhash field1 "foo"
(integer) 1
redis 127.0.0.1:6379> HSET myhash field2 "bar"
(integer) 1
redis 127.0.0.1:6379> HLEN myhash
(integer) 2

Redis hash (hash)