Files
services/cache/proto/cache.proto
2021-07-08 15:52:49 +01:00

85 lines
1.6 KiB
Protocol Buffer

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) {}
}
// Get an item from the cache by key
message GetRequest {
// The key to retrieve
string key = 1;
}
message GetResponse {
// The key
string key = 1;
// The value
string value = 2;
// Time to live in seconds
int64 ttl = 3;
}
// Set an item in the cache. Overwrites any existing value already set.
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;
}