func DefaultGet(req *protocol.McRequest, res *protocol.McResponse) error {
	for _, key := range req.Keys {
		value := dict[key]
		// TODO missed
		res.Values = append(res.Values, protocol.McValue{key, "0", value})
	}
	res.Response = "END"
	return nil
}
Пример #2
0
func (h *Handler) BFGet(req *protocol.McRequest, res *protocol.McResponse) error {
	var b []byte
	for _, key := range req.Keys {
		if exist := h.Get(key); exist {
			b = []byte("1")
		} else {
			b = []byte("0")
		}
		res.Values = append(res.Values, protocol.McValue{key, "0", b})
	}
	res.Response = "END"
	return nil
}