mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
add list keys to cache (#352)
* add list keys to cache * add list keys example
This commit is contained in:
13
cache/handler/cache.go
vendored
13
cache/handler/cache.go
vendored
@@ -120,3 +120,16 @@ func (c *Cache) Decrement(ctx context.Context, req *pb.DecrementRequest, rsp *pb
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cache) ListKeys(ctx context.Context, req *pb.ListKeysRequest, rsp *pb.ListKeysResponse) error {
|
||||
keys, err := cache.Context(ctx).ListKeys()
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("Error listing keys in cache %s", err)
|
||||
return errors.InternalServerError("cache.listkeys", "Error listing keys in cache")
|
||||
}
|
||||
|
||||
rsp.Keys = keys
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user