Redis - 如何列出数据库中的所有键?

Pau*_*est 1 javascript redis node.js

我开始玩 Redis,将一些值放入数据库。

var redis = require("redis"),
    client = redis.createClient();

// if you'd like to select database 3, instead of 0 (default), call
// client.select(3, function() { /* ... */ });

client.on("error", function (err) {
    console.log("Error " + err);
});

client.set("string key", "string val", redis.print);
client.hset("hash key", "hashtest 1", "some value", redis.print);
client.hset(["hash key", "hashtest 2", "some other value"], redis.print);
client.hkeys("hash key", function (err, replies) {
    console.log(replies.length + " replies:");
    replies.forEach(function (reply, i) {
        console.log("    " + i + ": " + reply);
    });
    client.quit();
});
Run Code Online (Sandbox Code Playgroud)

如何列出数据库中的所有键?

或者是否有免费的 GUI(Redsmin https://redsmin.com/仅在测试版时免费)

And*_*nak 5

使用带模式的方法*

根据文档

redis> MSET one 1 two 2 three 3 four 4
OK
redis> KEYS **
1) "one"
2) "two"
3) "three"
3) "four"
Run Code Online (Sandbox Code Playgroud)