From 794ff1beec10547a96cca04864796ba670f1c610 Mon Sep 17 00:00:00 2001 From: Dustin Sallings Date: Fri, 17 Feb 2012 23:31:23 -0800 Subject: [PATCH] Added StatsMap convenience function. --- client/mc.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/mc.go b/client/mc.go index a0e946c..d2496b2 100644 --- a/client/mc.go +++ b/client/mc.go @@ -148,6 +148,15 @@ func (client *Client) Stats(key string) []StatValue { return rv } +// Get the stats from the server as a map +func (client *Client) StatsMap(key string) map[string]string { + rv := make(map[string]string) + for _, sv := range client.Stats(key) { + rv[sv.Key] = sv.Val + } + return rv +} + func (client *Client) getResponse() gomemcached.MCResponse { bytesRead, err := io.ReadFull(client.conn, client.hdrBuf) if err != nil || bytesRead != gomemcached.HDR_LEN {