mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-21 15:05:01 +00:00
fix value usage in cache
This commit is contained in:
9
cache/handler/cache.go
vendored
9
cache/handler/cache.go
vendored
@@ -19,10 +19,15 @@ func (c *Cache) Get(ctx context.Context, req *pb.GetRequest, rsp *pb.GetResponse
|
|||||||
item := new(pb.Item)
|
item := new(pb.Item)
|
||||||
item.Key = req.Key
|
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())
|
return errors.InternalServerError("cache.get", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set the value
|
||||||
|
item.Value = value
|
||||||
|
|
||||||
return nil
|
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())
|
return errors.InternalServerError("cache.set", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
rsp.Status == "ok"
|
rsp.Status = "ok"
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user