What I need to do is to store a one-to-one mapping. The dataset consists of a large number of key-value pairs of the same kind (10M+). For example, one could use a single instance of HashMap object in Java for storing such data.
The first way to do this is to store lots of key-value pairs, like this:
SET map:key1 value1
...
SET map:key900000 value900000
GET map:key1
The second option is to use a single "Hash":
HSET map key1 value
...
HSET map key900000 value900000
HGET map key1
Redis Hashes have some convenient commands (HMSET, HMGET, HGETALL, etc.), and they don't pollute the keyspace, so this looks like a better option. However, are there any performance or memory considerations when using this approach?