Add KeYS command to server (bitraftd)

This commit is contained in:
James Mills 2019-03-21 10:49:53 +10:00
parent 352c32ee12
commit 34ad78efc0
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6

@ -96,6 +96,11 @@ func main() {
} else {
conn.WriteBulk(value)
}
case "keys":
conn.WriteArray(db.Len())
for key := range db.Keys() {
conn.WriteBulk([]byte(key))
}
case "exists":
if len(cmd.Args) != 2 {
conn.WriteError("ERR wrong number of arguments for '" + string(cmd.Args[0]) + "' command")