diff --git a/app/handlers/note.handler.go b/app/handlers/note.handler.go index 00c5e8a..e13e274 100644 --- a/app/handlers/note.handler.go +++ b/app/handlers/note.handler.go @@ -142,6 +142,8 @@ func UpdateNote(c *fiber.Ctx) error { // Update db.Model(¬e).Updates(noteRequest) + key := "note+" + id + redisclient.Remove(key) return c.Status(fiber.StatusCreated).JSON(fiber.Map{ "status": constants.STATUS_OK, @@ -170,6 +172,8 @@ func DeleteNote(c *fiber.Ctx) error { } db.Delete(¬e) + key := "note+" + id + redisclient.Remove(key) return c.SendStatus(fiber.StatusNoContent) } diff --git a/pkg/redis.client/redis.client.go b/pkg/redis.client/redis.client.go index 00991d9..805480c 100644 --- a/pkg/redis.client/redis.client.go +++ b/pkg/redis.client/redis.client.go @@ -62,3 +62,9 @@ func Set(key string, model interface{}, expired time.Duration) error { return nil } + +func Remove(key string) error { + redis := GetInstance() + fmt.Println("[REDIS][REMOVE] : ", key) + return redis.Do(ctx, "DEL", key).Err() +}