From e059a5f64a8336f2a40f69f22af8ced12ed2b368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AD=90=E9=93=AD?= Date: Thu, 20 Mar 2025 17:45:12 +0800 Subject: [PATCH] add cacke --- internal/data/repoimpl/product.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/data/repoimpl/product.go b/internal/data/repoimpl/product.go index c5a9fdd..871bab7 100644 --- a/internal/data/repoimpl/product.go +++ b/internal/data/repoimpl/product.go @@ -68,11 +68,11 @@ func (r *ProductRepoImpl) GetByPNO(ctx context.Context, PNO string) (*bo.Product item, err = r.getByPNO(ctx, item, PNO) b, err := json.Marshal(item) - if err == nil { - r.rdb.Rdb.Set(ctx, c.Key, string(b), c.TTL) + if err != nil { + return err } - return err + return r.rdb.Rdb.Set(ctx, c.Key, string(b), c.TTL).Err() }) if err != nil {