i got redis hash eg
key field value 1000 state "ca" 1000 zip "95054" 2000 state "ca" 2000 zip "95050" 3000 state "ny" 3000 zip "12345"
how can answer questions how many state "ca" . need count of values field. possible ? appreciated.
-avi
i think need store separate count unique values. can length of single hash, not when in case got 3 different keys.
command key field value
hset 1000 state "ca"
hset 1000 zip "95054"
incr ca
hset 2000 state "ca"
hset 2000 zip "95050"
incr ca
hset 3000 state "ny"
hset 3000 zip "12345"
incr ny
if want how many hash keys state "ca" use:
get ca
Comments
Post a Comment