From b8cbccb11349da4f0f06d38988ede92fa68535c1 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 27 Mar 2025 12:31:46 +0300 Subject: [PATCH] call memory's pop to free cache's current level --- internal/cmd/cmd.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index 5c550ea..66a4728 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -23,14 +23,14 @@ var ( ) type Cmd struct { - sessionId string - conn storage.ConnData - flagParser *application.FlagManager - cmd int - enable bool - exec func(ctx context.Context, ss storage.StorageService) error - engineConfig *engine.Config - st *state.State + sessionId string + conn storage.ConnData + flagParser *application.FlagManager + cmd int + enable bool + exec func(ctx context.Context, ss storage.StorageService) error + engineConfig *engine.Config + st *state.State } func NewCmd(sessionId string, flagParser *application.FlagManager) *Cmd { @@ -91,6 +91,9 @@ func (c *Cmd) execReset(ctx context.Context, ss storage.StorageService) error { if err != nil { return err } + ca := pe.GetMemory() + ca.Pop() + _, err = en.(*engine.DefaultEngine).Reset(ctx, false) if err != nil { return err @@ -169,7 +172,7 @@ func (c *Cmd) Parse(args []string) error { return fmt.Errorf("invalid command: %v", cmd) } if n > 0 { - if len(args) < n + 1 { + if len(args) < n+1 { return fmt.Errorf("Wrong number of arguments, need: %d", n) } param = args[1] @@ -192,6 +195,5 @@ func (c *Cmd) Parse(args []string) error { return nil } - return fmt.Errorf("unknown subcommand: %s", cmd) }