redis rpc服务, 提供redis操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

75 lines
1.4 KiB

syntax = "proto3";
package redisrpc;
// 使用key查询
message GetRequest {
string key = 1;
}
// 设置key
message SetRequest {
string key = 1;
string value = 2;
int64 ttl = 3;
}
message DelRequest {
string key = 1;
}
// 使用hash key查询
message HGetRequest {
string key = 1;
string field = 2;
}
// 设置hash key
message HSetRequest {
string key = 1;
string field = 2;
string value = 3;
}
// 删除hash key
message HDelRequest {
string key = 1;
string field = 2;
}
//有效期
message SetExpireRequest {
string key = 1;
int64 expire = 2;
}
// 使用key查询响应结构
message GetStringResponse {
string value = 1;
}
// 设置key响应结构
message SetResponse {
string ret = 1;
}
// 删除key响应结构
message DelResponse {
int64 ret = 1;
}
// 设置key响应结构
message HSetResponse {
int64 ret = 1;
}
// 设置key有效期
message SetExpireResponse {
int64 ret = 1;
}
// rpc方法
service RedisService {
rpc Get (GetRequest) returns (GetStringResponse); // 使用key查询
rpc Set (SetRequest) returns (SetResponse);
rpc Del (DelRequest) returns (DelResponse);
rpc HGet (HGetRequest) returns (GetStringResponse); // 使用hash key查询
rpc HSet (HSetRequest) returns (HSetResponse);
rpc HDel (HDelRequest) returns (DelResponse);
rpc SetExpire (SetExpireRequest) returns (SetExpireResponse); //设置有效期
}