Add info command (#141)

* Generate a new runid for each start of godis

* Add info command

* Add info command

* Generate a new runid for each start of godis

* Add unittests for the info command
This commit is contained in:
bjr
2023-03-19 16:17:40 +08:00
committed by GitHub
parent 3e6d2090c5
commit d7f6420f69
5 changed files with 128 additions and 2 deletions

View File

@@ -17,6 +17,8 @@ import (
"time"
)
var godisVersion = "1.2.8" // do not modify
// Server is a redis-server with full capabilities including multiple database, rdb loader, replication
type Server struct {
dbSet []*atomic.Value // *DB
@@ -90,6 +92,10 @@ func (server *Server) Exec(c redis.Connection, cmdLine [][]byte) (result redis.R
if cmdName == "auth" {
return Auth(c, cmdLine[1:])
}
// info
if cmdName == "info" {
return Info(c, cmdLine)
}
if !isAuthenticated(c) {
return protocol.MakeErrReply("NOAUTH Authentication required")
}