I do not think this can be achieved using a globe style template.
I would also like to note that even if there was a template that corresponded to the phrases presented, due to the nature of the SCAN, you would need to iterate over the entire data set (making separate calls) to get the results you are looking for, Then you will need consider the fact that your data may change during the iteration period.
From the documents
It is important to note that the MATCH filter is applied after items are retrieved from the collection immediately before returning data to the client. This means that if the template has very few elements within the collection, SCAN will most likely not return any elements in most iterations.
Link: https://redis.io/commands/scan#the-match-option
-
Option 1
Use SCAN to iterate over the entire data set and further filter the data at the application level.
Option 2
Depending on what type of guarantee you are looking for and how much data you have, you can use KEYS . This is usually not a recommended approach, but it is an option to consider.
Example: KEYS '*136 mountain*'
It sounds like a SCAN approach, you will have a greater response than the one you are looking for, and you will need to use your language to further filter the result.
Option 3
Index your data with some application-level preprocessing. If the key matches your desired pattern, add it to SET / Sorted Set .
Option 4
Write a Lua script.
source share