What I need to do is keep the one-to-one mapping. A data set consists of a large number of key-value pairs of the same type (10M +). For example, you can use one instance of a HashMap object in Java to store such data.
The first way to do this is to store many key-value pairs, for example:
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 do not pollute the key space, so this looks like the best option. However, are there any performance or memory considerations when using this approach?
redis
Max malysh
source share