fix value usage in cache

This commit is contained in:
Asim Aslam
2021-05-19 14:24:17 +01:00
parent e9264b78e0
commit 214af96fa4

View File

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