syntax = "proto3";

package cacheserver;

service Cache {
    rpc Get (stream GetRequest) returns (stream GetResponse);
    rpc Exists (stream GetRequest) returns (stream ExistsResponse);
    rpc Set (stream SetRequest) returns (stream SetResponse);
}

message GetRequest {
    string id = 1; //Unique request id, generate in client
    repeated string keys = 2;
}

message GetResponse {
    string id = 1; //Unique request id, generate in client
    repeated string values = 2;
}

message ExistsResponse {
    string id = 1; //Unique request id, generate in client
    repeated bool exists = 2;
}

message SetRequest {
    string key = 1;
    string value = 2;
    uint32 ttl = 3;
}

message SetResponse {
    string key = 1;
    bool saved = 2;
}
