remove from redis

dev
ajikamaludin 2 years ago
parent 609ea4814c
commit d05c2eb50d
Signed by: ajikamaludin
GPG Key ID: 476C9A2B4B794EBB

@ -142,6 +142,8 @@ func UpdateNote(c *fiber.Ctx) error {
// Update
db.Model(&note).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(&note)
key := "note+" + id
redisclient.Remove(key)
return c.SendStatus(fiber.StatusNoContent)
}

@ -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()
}

Loading…
Cancel
Save