예제 #1
0
func (c *Client) Get(key string) (int, string) {
	request := new(protobuf.Request)
	request.Id = proto.String(randomId())
	request.Type = proto.String("get")
	request.Key = proto.String(key)

	callback := c.write(request)
	if callback == nil {
		return -1, ""
	}

	// Block on callback
	response := <-callback
	return int(response.GetResult()), response.GetValue()
}