From 214af96fa42abfe4c877b5c6beef0c6cfdd7b373 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 19 May 2021 14:24:17 +0100 Subject: [PATCH] fix value usage in cache --- cache/handler/cache.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cache/handler/cache.go b/cache/handler/cache.go index c3074fb..b21c60a 100644 --- a/cache/handler/cache.go +++ b/cache/handler/cache.go @@ -19,10 +19,15 @@ func (c *Cache) Get(ctx context.Context, req *pb.GetRequest, rsp *pb.GetResponse item := new(pb.Item) item.Key = req.Key - if err := cache.Context(ctx).Get(req.Key, &item.Value); err != nil { + var value string + + if err := cache.Context(ctx).Get(req.Key, &value); err != nil { return errors.InternalServerError("cache.get", err.Error()) } + // set the value + item.Value = value + return nil } @@ -41,7 +46,7 @@ func (c *Cache) Set(ctx context.Context, req *pb.SetRequest, rsp *pb.SetResponse return errors.InternalServerError("cache.set", err.Error()) } - rsp.Status == "ok" + rsp.Status = "ok" return nil }