Latest web development tutorials

Redis Keys command

Redis key (key)

Redis Keys command is used to find all matching the given pattern pattern of key. .

grammar

redis KEYS basic command syntax is as follows:

redis 127.0.0.1:6379> KEYS PATTERN

Available versions

> = 1.0.0

return value

Match a given pattern key list (Array).

Examples

First create some key, and assign the corresponding value:

redis 127.0.0.1:6379> SET w3big1 redis
OK
redis 127.0.0.1:6379> SET w3big2 mysql
OK
redis 127.0.0.1:6379> SET w3big3 mongodb
OK

Look for w3big beginning with key:

redis 127.0.0.1:6379> KEYS w3big*
1) "w3big3"
2) "w3big1"
3) "w3big2"

Get all of the key redis available usage*.

redis 127.0.0.1:6379> KEYS *
1) "w3big3"
2) "w3big1"
3) "w3big2"

Redis key (key)