add list keys to cache (#352)

* add list keys to cache

* add list keys example
This commit is contained in:
Asim Aslam
2022-01-14 17:38:47 +00:00
committed by GitHub
parent f96ace75c2
commit 6a7d7db044
6 changed files with 250 additions and 50 deletions

View File

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