Reputation: 715
I have many hash in my game which have values like
HMSET('hash1', 'level', 25, 'connected', 2)
HMSET('hash2', 'level', 50, 'connected', 2)
HMSET('hash3', 'level', 15, 'connected', 3)
HMSET('hash3', 'level', 15, 'connected', 2)
I want to find the hash which has level value 50. Can I Find the hash by this or not, if yes then how?
Also specifying 2 queries like level is 15 and connected must be less than 3?
Upvotes: 2
Views: 347
Reputation: 9568
Redis doesn't support secondary index out of the box. But, you can model it using different built in data structures like Sorted Set, you can read more about it here: https://redis.io/topics/indexes
If you want a more advanced solution you should check RediSearch, RediSearch is a Redis module adding Secondary Index and Full-Text and engine.
Upvotes: 3