Пример #1
0
func (r *clientRPC) Put(req *api.Request) *api.Response {
	var res api.Response
	err := r.s.Put(req.Key, req.Value, &libkvstore.WriteOptions{TTL: req.TTL})
	if err != nil {
		res.Err = err.Error()
	}
	return &res
}
Пример #2
0
func (r *clientRPC) Get(req *api.Request) *api.Response {
	var res api.Response
	kv, err := r.s.Get(req.Key)
	if err != nil {
		res.Err = err.Error()
		return &res
	}
	res.KV = libkvToKV(kv)
	return &res
}