Made GET, MGET, SET, MSET, SETNX commands compatible with redis client

This commit is contained in:
Kelvin Clement Mwinuka
2024-02-27 15:41:22 +08:00
parent 42154fe7dd
commit 088e4c25f0
8 changed files with 264 additions and 219 deletions

View File

@@ -208,6 +208,7 @@ func (server *Server) handleConnection(ctx context.Context, conn net.Conn) {
if err != nil && errors.Is(err, io.EOF) {
// Connection closed
log.Println(err)
break
}
@@ -219,7 +220,7 @@ func (server *Server) handleConnection(ctx context.Context, conn net.Conn) {
res, err := server.handleCommand(ctx, message, &conn, false)
if err != nil {
if _, err = w.Write([]byte(fmt.Sprintf("-Error %s\r\n\r\n", err.Error()))); err != nil {
if _, err = w.Write([]byte(fmt.Sprintf("-Error %s\r\n", err.Error()))); err != nil {
log.Println(err)
}
continue