开发者

Redis: Is it possible to get just one value of a Set by its key?

I have a Set named 'Projects' with many key-value pairs and I want to retrieve one of the values by provid开发者_如何学运维ing its key. I checked the redis doc but I only found how to retrieve the entire Set. Is it possible to just retrieve one value by providing its key?


Your concept of Set does not match Redis'.

All members of a set in Redis are stored in a single key. Therefore you can't access members individually by a key.

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

HSET key field value does what you are looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜