]>
Commit | Line | Data |
---|---|---|
ed9b544e | 1 | |
2 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> | |
3 | <html> | |
4 | <head> | |
5 | <link type="text/css" rel="stylesheet" href="style.css" /> | |
6 | </head> | |
7 | <body> | |
8 | <div id="page"> | |
9 | ||
10 | <div id='header'> | |
11 | <a href="index.html"> | |
12 | <img style="border:none" alt="Redis Documentation" src="redis.png"> | |
13 | </a> | |
14 | </div> | |
15 | ||
16 | <div id="pagecontent"> | |
17 | <div class="index"> | |
18 | <!-- This is a (PRE) block. Make sure it's left aligned or your toc title will be off. --> | |
19 | <b>KeysCommand: Contents</b><br> <a href="#KEYS _pattern_">KEYS _pattern_</a><br> <a href="#Return value">Return value</a><br> <a href="#See also">See also</a> | |
20 | </div> | |
21 | ||
22 | <h1 class="wikiname">KeysCommand</h1> | |
23 | ||
24 | <div class="summary"> | |
25 | ||
26 | </div> | |
27 | ||
28 | <div class="narrow"> | |
29 | <h1><a name="KEYS _pattern_">KEYS _pattern_</a></h1> | |
30 | <i>Time complexity: O(n) (with n being the number of keys in the DB, and assuming keys and pattern of limited length)</i><blockquote>Returns all the keys matching the glob-style <i>pattern</i> asspace separated strings. For example if you have in thedatabase the keys "foo" and "foobar" the command "KEYS foo<code name="code" class="python">*</code>"will return "foo foobar".</blockquote> | |
31 | <blockquote>Note that while the time complexity for this operation is O(n)the constant times are pretty low. For example Redis runningon an entry level laptop can scan a 1 million keys databasein 40 milliseconds. Still it's better to consider this one ofthe slow commands that may ruin the DB performance if not usedwith care.</blockquote> | |
32 | Glob style patterns examples: | |
33 | <ul><li> h?llo will match hello hallo hhllo</li><li> h<b>llo will match hllo heeeello | |
34 | <blockquote>* h<a href="ae.html">ae</a>llo will match hello and hallo, but not hillo</blockquote>Use \ to escape special chars if you want to match them verbatim.<h2><a name="Return value">Return value</a></h2><a href="ReplyTypes.html">Bulk reply</a>, specifically a string in the form of space separated list of keys. Note that most client libraries will return an Array of keys and not a single string with space separated keys (that is, split by " " is performed in the client library usually).<h2><a name="See also">See also</a></h2> | |
35 | <blockquote>* <a href="RandomkeyCommand.html">RANDOMKEY</a> to get the name of a randomly selected key in O(1).</blockquote></b></li></ul> | |
36 | </div> | |
37 | ||
38 | </div> | |
39 | </div> | |
40 | </body> | |
41 | </html> | |
42 |