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.
 

58 lines
1.1 KiB

syntax = "proto3";
package redisrpc;
// 使用key查询
message GetRequest {
string key = 1;
}
// 设置key
message SetRequest {
string key = 1;
string value = 2;
uint64 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;
}
// 使用key查询响应结构
message GetStringResponse {
string value = 1;
}
// 设置key响应结构
message SetResponse {
uint64 ret = 1;
}
// 删除key响应结构
message DelResponse {
uint64 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 (SetResponse);
rpc HDel (HDelRequest) returns (DelResponse);
}