admin管理员组文章数量:1355111
I start playing with Redis, put some values into database.
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();
});
How to list all keys in database?
or is there free GUI (Redsmin / is free only while beta)
I start playing with Redis, put some values into database.
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();
});
How to list all keys in database?
or is there free GUI (Redsmin https://redsmin./ is free only while beta)
Share Improve this question asked Oct 14, 2013 at 7:23 Paul VerestPaul Verest 64.1k53 gold badges225 silver badges353 bronze badges 2-
Looks like you're looking for
keys
mand. – Leonid Beschastny Commented Oct 14, 2013 at 7:47 - 1 Hello Paul, founder of Redsmin there, just to confirm that there will always be a free plan in Redsmin because we want to give back to the awesome Redis munity :) – FGRibreau Commented Oct 15, 2013 at 9:01
2 Answers
Reset to default 6Use keys method with pattern *
According to the docs
redis> MSET one 1 two 2 three 3 four 4
OK
redis> KEYS **
1) "one"
2) "two"
3) "three"
3) "four"
This works, but as written in the docs
Warning: consider KEYS as a mand that should only be used in production environments with extreme care. It may ruin performance when it is executed against large databases. This mand is intended for debugging and special operations, such as changing your keyspace layout. Don't use KEYS in your regular application code. If you're looking for a way to find keys in a subset of your keyspace, consider using SCAN or sets.
Therefore until you work on a local project KEY mand is fine, but avoid using it on production.
If you want a Redis GUI, you can have a look at Redis Desktop. I work with it and it is very useful.
本文标签: javascriptRedisHow to list all keys in databaseStack Overflow
版权声明:本文标题:javascript - Redis - How to list all keys in database? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743950732a2567242.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论