我开始玩 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();
});
如何列出数据库中的所有key?
或者是否有免费的 GUI(Redsmin https://redsmin.com/ 仅在测试版时免费)
最佳答案
使用keys方法和模式*
根据docs
redis> MSET one 1 two 2 three 3 four 4
OK
redis> KEYS **
1) "one"
2) "two"
3) "three"
3) "four"
关于javascript - Redis - 如何列出数据库中的所有键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19355272/