What's the practical difference between keeping data in multiple hashes (HSET foo oof 1
, HSET bar rab 2
) and using plain keys in a hierarchy (SET foo:oof 1
, SET bar:rab 2
)?
According to the manual, you'd use hashes to represent a single object.
Also, it's not that efficient to iterate over Redis keys, so if you need to get all the data from a single object, HGETALL
is your friend, not a KEYS thing:10:*
/multiget fiasco.
However, you can't e.g. set expiry for only one key of a hash, so if you need that functionality, you'll want to use regular keys.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With