2

I use redis hash to store my data. The key is a fixed value, the field stores "id" + "type" and the value stores the corresponding data. Is there anyway to query the data through a fuzzy key?

For example

The record is "ABC" : "12301" : "abc" and "ABC" : "12302" : "def", I want to use "ABC" + "123*"to query out the two records.

Thanks in advance!

asked Jan 29, 2019 at 4:04

1 Answer 1

2

Yes and no.

You can use HSCAN with glob-like patterns, which appears to be what you need.

That said, scanning big Hashes can be time-consuming. Instead, you can build your own indices (see for example Lexicographical Indexes or use a search engine such as RediSearch.

answered Jan 29, 2019 at 16:33
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.