Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding keys using wildcards

Tags:

I have saved the data using semicolon.

redis> keys party:*  1) "party:congress:president" 2) "party:bjp:president" 3) "party:bjp" 4) "party:sena" 

Is there any command that will list of all the parties? In case of above example, I expect

congress bjp sena 
like image 988
shantanuo Avatar asked Jan 05 '12 14:01

shantanuo


People also ask

How do you do a wildcard search?

Wildcard Searches To perform a multiple character wildcard search use the "*" symbol. You can also use the wildcard searches in the middle of a term. Note: You cannot use a * or ? symbol as the first character of a search.

What is the symbol for a wildcard search?

The asterisk (*) is used in many databases for truncation. Wildcards — a symbol used to represent any character. Wildcards can usually be used at the end of a word or within a word. The pound symbol (#) is used in many databases as a wildcard.

How do you use wildcard characters in access?

The asterisk “*” and the question mark “?” are the two main wildcard characters in Access you need to know. The asterisk represents multiple unknown characters. For example, the criteria “N*” would find all “N” words like “Nebraska,” “Ned,” “Not,” “Never Ever,” etc. The question mark represents one unknown character.


1 Answers

No, there is no command to do that. But it would be trivial to implement it on client side, if you really have to.

Applications should never use the KEYS commands to retrieve data. KEYS blocks the whole Redis instance while it is scanning linearly the millions of keys you have stored. It is more a debugging command supposed to be used in administration tools.

With Redis, there is no btree structure to index the keys, so you cannot query for keys, except if your keys are stored in an existing collection (set, zset, etc ...)

like image 103
Didier Spezia Avatar answered Oct 23 '22 03:10

Didier Spezia