mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-17 13:24:56 +00:00
add the cache service (#112)
This commit is contained in:
89
cache/proto/cache.proto
vendored
Normal file
89
cache/proto/cache.proto
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cache;
|
||||
|
||||
option go_package = "./proto;cache";
|
||||
|
||||
service Cache {
|
||||
rpc Get(GetRequest) returns (GetResponse) {}
|
||||
rpc Set(SetRequest) returns (SetResponse) {}
|
||||
rpc Delete(DeleteRequest) returns (DeleteResponse) {}
|
||||
rpc Increment(IncrementRequest) returns (IncrementResponse) {}
|
||||
rpc Decrement(DecrementRequest) returns (DecrementResponse) {}
|
||||
}
|
||||
|
||||
message Item {
|
||||
// The key
|
||||
string key = 1;
|
||||
// The value
|
||||
string value = 2;
|
||||
// Time to live in seconds
|
||||
int64 ttl = 3;
|
||||
}
|
||||
|
||||
// Get an item from the cache by key
|
||||
message GetRequest {
|
||||
// The key to retrieve
|
||||
string key = 1;
|
||||
}
|
||||
|
||||
message GetResponse {
|
||||
// The item in the cache
|
||||
Item item = 1;
|
||||
}
|
||||
|
||||
// Set an item in the cache
|
||||
message SetRequest {
|
||||
// The key to update
|
||||
string key = 1;
|
||||
// The value to set
|
||||
string value = 2;
|
||||
// Time to live in seconds
|
||||
int64 ttl = 3;
|
||||
}
|
||||
|
||||
message SetResponse {
|
||||
// Returns "ok" if successful
|
||||
string status = 1;
|
||||
}
|
||||
|
||||
// Delete a value from the cache
|
||||
message DeleteRequest {
|
||||
// The key to delete
|
||||
string key = 1;
|
||||
}
|
||||
|
||||
message DeleteResponse {
|
||||
// Returns "ok" if successful
|
||||
string status = 1;
|
||||
}
|
||||
|
||||
// Increment a value (if its a number)
|
||||
message IncrementRequest {
|
||||
// The key to increment
|
||||
string key = 1;
|
||||
// The value to add
|
||||
int64 value = 2;
|
||||
}
|
||||
|
||||
message IncrementResponse {
|
||||
// The key incremented
|
||||
string key = 1;
|
||||
// The result value
|
||||
int64 value = 2;
|
||||
}
|
||||
|
||||
// Decrement a value (if its a number)
|
||||
message DecrementRequest {
|
||||
// The key to decrement
|
||||
string key = 1;
|
||||
// The delta value to decrement
|
||||
int64 value = 2;
|
||||
}
|
||||
|
||||
message DecrementResponse {
|
||||
// The key of the item
|
||||
string key = 1;
|
||||
// The result value of the item
|
||||
int64 value = 2;
|
||||
}
|
||||
Reference in New Issue
Block a user