Redis: Is it possible to get only one Set value by its key?

I have a Set named 'Projects' with many key-value pairs, and I want to get one of the values ​​by providing its key. I checked redis doc, but I only found how to get the whole set. Is it possible to simply get a single value by providing its key?

+6
source share
1 answer

Your Set concept doesn't match Redis'.

All elements of a set in Redis are stored in one key. Therefore, you cannot access the elements individually using the key.

You must use hashes: http://www.redis.io/commands#hash

HSET key field value does what you are looking for.

+11
source

Source: https://habr.com/ru/post/888229/


All Articles