|
|
@ -15,10 +15,12 @@ It has these top-level messages: |
|
|
|
HGetRequest |
|
|
|
HSetRequest |
|
|
|
HDelRequest |
|
|
|
SetExpireRequest |
|
|
|
GetStringResponse |
|
|
|
SetResponse |
|
|
|
DelResponse |
|
|
|
HSetResponse |
|
|
|
SetExpireResponse |
|
|
|
*/ |
|
|
|
package redisrpc |
|
|
|
|
|
|
@ -185,6 +187,31 @@ func (m *HDelRequest) GetField() string { |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
// 有效期
|
|
|
|
type SetExpireRequest struct { |
|
|
|
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` |
|
|
|
Expire *uint64 `protobuf:"varint,2,opt,name=expire" json:"expire,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *SetExpireRequest) Reset() { *m = SetExpireRequest{} } |
|
|
|
func (m *SetExpireRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*SetExpireRequest) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *SetExpireRequest) GetKey() string { |
|
|
|
if m != nil && m.Key != nil { |
|
|
|
return *m.Key |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *SetExpireRequest) GetExpire() uint64 { |
|
|
|
if m != nil && m.Expire != nil { |
|
|
|
return *m.Expire |
|
|
|
} |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
|
// 使用key查询响应结构
|
|
|
|
type GetStringResponse struct { |
|
|
|
Value *string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` |
|
|
@ -253,6 +280,23 @@ func (m *HSetResponse) GetRet() uint64 { |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
|
// 设置key有效期
|
|
|
|
type SetExpireResponse struct { |
|
|
|
Ret *uint64 `protobuf:"varint,1,opt,name=ret" json:"ret,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *SetExpireResponse) Reset() { *m = SetExpireResponse{} } |
|
|
|
func (m *SetExpireResponse) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*SetExpireResponse) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *SetExpireResponse) GetRet() uint64 { |
|
|
|
if m != nil && m.Ret != nil { |
|
|
|
return *m.Ret |
|
|
|
} |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
|
func init() { |
|
|
|
} |
|
|
|
|
|
|
@ -263,6 +307,7 @@ type RedisService interface { |
|
|
|
HGet(in *HGetRequest, out *GetStringResponse) error |
|
|
|
HSet(in *HSetRequest, out *HSetResponse) error |
|
|
|
HDel(in *HDelRequest, out *DelResponse) error |
|
|
|
SetExpire(in *SetExpireRequest, out *SetExpireResponse) error |
|
|
|
} |
|
|
|
|
|
|
|
// AcceptRedisServiceClient accepts connections on the listener and serves requests
|
|
|
@ -352,6 +397,9 @@ func (c *RedisServiceClient) HSet(in *HSetRequest, out *HSetResponse) error { |
|
|
|
func (c *RedisServiceClient) HDel(in *HDelRequest, out *DelResponse) error { |
|
|
|
return c.Call("RedisService.HDel", in, out) |
|
|
|
} |
|
|
|
func (c *RedisServiceClient) SetExpire(in *SetExpireRequest, out *SetExpireResponse) error { |
|
|
|
return c.Call("RedisService.SetExpire", in, out) |
|
|
|
} |
|
|
|
|
|
|
|
// DialRedisService connects to an RedisService at the specified network address.
|
|
|
|
func DialRedisService(network, addr string) (*RedisServiceClient, *rpc.Client, error) { |
|
|
|