Skip to content

Commit

Permalink
Added StatsMap convenience function.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Feb 18, 2012
1 parent bfe8236 commit 794ff1b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/mc.go
Expand Up @@ -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 {
Expand Down

0 comments on commit 794ff1b

Please sign in to comment.