I want to store a JSON payload into redis. There’s really 2 ways I can do this:
-
One using a simple string keys and values.
key:user, value:payload (the entire JSON blob which can be 100-200 KB)SET user:1 payload
-
Using hashes
HSET user:1 username "someone"
HSET user:1 location "NY"
HSET user:1 bio "STRING WITH OVER 100 lines"
Keep in mind that if I use a hash, the value length isn’t predictable. They’re not all short such as the bio example above.
Which is more memory efficient? Using string keys and values, or using a hash?