flatten get response

This commit is contained in:
Asim Aslam
2021-05-19 14:51:46 +01:00
parent 4981909baf
commit d46644bf4c
3 changed files with 145 additions and 219 deletions

View File

@@ -16,20 +16,15 @@ func (c *Cache) Get(ctx context.Context, req *pb.GetRequest, rsp *pb.GetResponse
return errors.BadRequest("cache.get", "missing key") return errors.BadRequest("cache.get", "missing key")
} }
item := new(pb.Item)
item.Key = req.Key
var value string var value string
if err := cache.Context(ctx).Get(req.Key, &value); err != nil { if err := cache.Context(ctx).Get(req.Key, &value); err != nil {
return errors.InternalServerError("cache.get", err.Error()) return errors.InternalServerError("cache.get", err.Error())
} }
rsp.Key = req.Key
// set the value // set the value
item.Value = value rsp.Value = value
// set the item
rsp.Item = item
return nil return nil
} }

View File

@@ -20,72 +20,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type Item struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The key
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
// The value
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// Time to live in seconds
Ttl int64 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"`
}
func (x *Item) Reset() {
*x = Item{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Item) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Item) ProtoMessage() {}
func (x *Item) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Item.ProtoReflect.Descriptor instead.
func (*Item) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{0}
}
func (x *Item) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *Item) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
func (x *Item) GetTtl() int64 {
if x != nil {
return x.Ttl
}
return 0
}
// Get an item from the cache by key // Get an item from the cache by key
type GetRequest struct { type GetRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
@@ -99,7 +33,7 @@ type GetRequest struct {
func (x *GetRequest) Reset() { func (x *GetRequest) Reset() {
*x = GetRequest{} *x = GetRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[1] mi := &file_proto_cache_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -112,7 +46,7 @@ func (x *GetRequest) String() string {
func (*GetRequest) ProtoMessage() {} func (*GetRequest) ProtoMessage() {}
func (x *GetRequest) ProtoReflect() protoreflect.Message { func (x *GetRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[1] mi := &file_proto_cache_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -125,7 +59,7 @@ func (x *GetRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. // Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.
func (*GetRequest) Descriptor() ([]byte, []int) { func (*GetRequest) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{1} return file_proto_cache_proto_rawDescGZIP(), []int{0}
} }
func (x *GetRequest) GetKey() string { func (x *GetRequest) GetKey() string {
@@ -140,14 +74,18 @@ type GetResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// The item in the cache // The key
Item *Item `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
// The value
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// Time to live in seconds
Ttl int64 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"`
} }
func (x *GetResponse) Reset() { func (x *GetResponse) Reset() {
*x = GetResponse{} *x = GetResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[2] mi := &file_proto_cache_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -160,7 +98,7 @@ func (x *GetResponse) String() string {
func (*GetResponse) ProtoMessage() {} func (*GetResponse) ProtoMessage() {}
func (x *GetResponse) ProtoReflect() protoreflect.Message { func (x *GetResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[2] mi := &file_proto_cache_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -173,14 +111,28 @@ func (x *GetResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetResponse.ProtoReflect.Descriptor instead. // Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.
func (*GetResponse) Descriptor() ([]byte, []int) { func (*GetResponse) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{2} return file_proto_cache_proto_rawDescGZIP(), []int{1}
} }
func (x *GetResponse) GetItem() *Item { func (x *GetResponse) GetKey() string {
if x != nil { if x != nil {
return x.Item return x.Key
} }
return nil return ""
}
func (x *GetResponse) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
func (x *GetResponse) GetTtl() int64 {
if x != nil {
return x.Ttl
}
return 0
} }
// Set an item in the cache // Set an item in the cache
@@ -200,7 +152,7 @@ type SetRequest struct {
func (x *SetRequest) Reset() { func (x *SetRequest) Reset() {
*x = SetRequest{} *x = SetRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[3] mi := &file_proto_cache_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -213,7 +165,7 @@ func (x *SetRequest) String() string {
func (*SetRequest) ProtoMessage() {} func (*SetRequest) ProtoMessage() {}
func (x *SetRequest) ProtoReflect() protoreflect.Message { func (x *SetRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[3] mi := &file_proto_cache_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -226,7 +178,7 @@ func (x *SetRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SetRequest.ProtoReflect.Descriptor instead. // Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.
func (*SetRequest) Descriptor() ([]byte, []int) { func (*SetRequest) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{3} return file_proto_cache_proto_rawDescGZIP(), []int{2}
} }
func (x *SetRequest) GetKey() string { func (x *SetRequest) GetKey() string {
@@ -262,7 +214,7 @@ type SetResponse struct {
func (x *SetResponse) Reset() { func (x *SetResponse) Reset() {
*x = SetResponse{} *x = SetResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[4] mi := &file_proto_cache_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -275,7 +227,7 @@ func (x *SetResponse) String() string {
func (*SetResponse) ProtoMessage() {} func (*SetResponse) ProtoMessage() {}
func (x *SetResponse) ProtoReflect() protoreflect.Message { func (x *SetResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[4] mi := &file_proto_cache_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -288,7 +240,7 @@ func (x *SetResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SetResponse.ProtoReflect.Descriptor instead. // Deprecated: Use SetResponse.ProtoReflect.Descriptor instead.
func (*SetResponse) Descriptor() ([]byte, []int) { func (*SetResponse) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{4} return file_proto_cache_proto_rawDescGZIP(), []int{3}
} }
func (x *SetResponse) GetStatus() string { func (x *SetResponse) GetStatus() string {
@@ -311,7 +263,7 @@ type DeleteRequest struct {
func (x *DeleteRequest) Reset() { func (x *DeleteRequest) Reset() {
*x = DeleteRequest{} *x = DeleteRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[5] mi := &file_proto_cache_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -324,7 +276,7 @@ func (x *DeleteRequest) String() string {
func (*DeleteRequest) ProtoMessage() {} func (*DeleteRequest) ProtoMessage() {}
func (x *DeleteRequest) ProtoReflect() protoreflect.Message { func (x *DeleteRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[5] mi := &file_proto_cache_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -337,7 +289,7 @@ func (x *DeleteRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. // Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.
func (*DeleteRequest) Descriptor() ([]byte, []int) { func (*DeleteRequest) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{5} return file_proto_cache_proto_rawDescGZIP(), []int{4}
} }
func (x *DeleteRequest) GetKey() string { func (x *DeleteRequest) GetKey() string {
@@ -359,7 +311,7 @@ type DeleteResponse struct {
func (x *DeleteResponse) Reset() { func (x *DeleteResponse) Reset() {
*x = DeleteResponse{} *x = DeleteResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[6] mi := &file_proto_cache_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -372,7 +324,7 @@ func (x *DeleteResponse) String() string {
func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) ProtoMessage() {}
func (x *DeleteResponse) ProtoReflect() protoreflect.Message { func (x *DeleteResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[6] mi := &file_proto_cache_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -385,7 +337,7 @@ func (x *DeleteResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. // Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.
func (*DeleteResponse) Descriptor() ([]byte, []int) { func (*DeleteResponse) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{6} return file_proto_cache_proto_rawDescGZIP(), []int{5}
} }
func (x *DeleteResponse) GetStatus() string { func (x *DeleteResponse) GetStatus() string {
@@ -410,7 +362,7 @@ type IncrementRequest struct {
func (x *IncrementRequest) Reset() { func (x *IncrementRequest) Reset() {
*x = IncrementRequest{} *x = IncrementRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[7] mi := &file_proto_cache_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -423,7 +375,7 @@ func (x *IncrementRequest) String() string {
func (*IncrementRequest) ProtoMessage() {} func (*IncrementRequest) ProtoMessage() {}
func (x *IncrementRequest) ProtoReflect() protoreflect.Message { func (x *IncrementRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[7] mi := &file_proto_cache_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -436,7 +388,7 @@ func (x *IncrementRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use IncrementRequest.ProtoReflect.Descriptor instead. // Deprecated: Use IncrementRequest.ProtoReflect.Descriptor instead.
func (*IncrementRequest) Descriptor() ([]byte, []int) { func (*IncrementRequest) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{7} return file_proto_cache_proto_rawDescGZIP(), []int{6}
} }
func (x *IncrementRequest) GetKey() string { func (x *IncrementRequest) GetKey() string {
@@ -467,7 +419,7 @@ type IncrementResponse struct {
func (x *IncrementResponse) Reset() { func (x *IncrementResponse) Reset() {
*x = IncrementResponse{} *x = IncrementResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[8] mi := &file_proto_cache_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -480,7 +432,7 @@ func (x *IncrementResponse) String() string {
func (*IncrementResponse) ProtoMessage() {} func (*IncrementResponse) ProtoMessage() {}
func (x *IncrementResponse) ProtoReflect() protoreflect.Message { func (x *IncrementResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[8] mi := &file_proto_cache_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -493,7 +445,7 @@ func (x *IncrementResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use IncrementResponse.ProtoReflect.Descriptor instead. // Deprecated: Use IncrementResponse.ProtoReflect.Descriptor instead.
func (*IncrementResponse) Descriptor() ([]byte, []int) { func (*IncrementResponse) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{8} return file_proto_cache_proto_rawDescGZIP(), []int{7}
} }
func (x *IncrementResponse) GetKey() string { func (x *IncrementResponse) GetKey() string {
@@ -525,7 +477,7 @@ type DecrementRequest struct {
func (x *DecrementRequest) Reset() { func (x *DecrementRequest) Reset() {
*x = DecrementRequest{} *x = DecrementRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[9] mi := &file_proto_cache_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -538,7 +490,7 @@ func (x *DecrementRequest) String() string {
func (*DecrementRequest) ProtoMessage() {} func (*DecrementRequest) ProtoMessage() {}
func (x *DecrementRequest) ProtoReflect() protoreflect.Message { func (x *DecrementRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[9] mi := &file_proto_cache_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -551,7 +503,7 @@ func (x *DecrementRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DecrementRequest.ProtoReflect.Descriptor instead. // Deprecated: Use DecrementRequest.ProtoReflect.Descriptor instead.
func (*DecrementRequest) Descriptor() ([]byte, []int) { func (*DecrementRequest) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{9} return file_proto_cache_proto_rawDescGZIP(), []int{8}
} }
func (x *DecrementRequest) GetKey() string { func (x *DecrementRequest) GetKey() string {
@@ -582,7 +534,7 @@ type DecrementResponse struct {
func (x *DecrementResponse) Reset() { func (x *DecrementResponse) Reset() {
*x = DecrementResponse{} *x = DecrementResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_cache_proto_msgTypes[10] mi := &file_proto_cache_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -595,7 +547,7 @@ func (x *DecrementResponse) String() string {
func (*DecrementResponse) ProtoMessage() {} func (*DecrementResponse) ProtoMessage() {}
func (x *DecrementResponse) ProtoReflect() protoreflect.Message { func (x *DecrementResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_cache_proto_msgTypes[10] mi := &file_proto_cache_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -608,7 +560,7 @@ func (x *DecrementResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DecrementResponse.ProtoReflect.Descriptor instead. // Deprecated: Use DecrementResponse.ProtoReflect.Descriptor instead.
func (*DecrementResponse) Descriptor() ([]byte, []int) { func (*DecrementResponse) Descriptor() ([]byte, []int) {
return file_proto_cache_proto_rawDescGZIP(), []int{10} return file_proto_cache_proto_rawDescGZIP(), []int{9}
} }
func (x *DecrementResponse) GetKey() string { func (x *DecrementResponse) GetKey() string {
@@ -629,63 +581,61 @@ var File_proto_cache_proto protoreflect.FileDescriptor
var file_proto_cache_proto_rawDesc = []byte{ var file_proto_cache_proto_rawDesc = []byte{
0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x70, 0x72, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, 0x22, 0x40, 0x0a, 0x04, 0x49, 0x74, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, 0x22, 0x1e, 0x0a, 0x0a, 0x47, 0x65,
0x65, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x47, 0x0a, 0x0b, 0x47, 0x65,
0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x22, 0x1e, 0x0a, 0x0a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x2e, 0x0a, 0x0b, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03,
0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x74, 0x74, 0x6c, 0x22, 0x46, 0x0a, 0x0a, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x46, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x22, 0x25, 0x0a, 0x0b, 0x53,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74,
0x75, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
0x03, 0x74, 0x74, 0x6c, 0x22, 0x25, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x75, 0x73, 0x22, 0x21, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75,
0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x21, 0x0a, 0x0d, 0x44, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x28, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x28, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x3a, 0x0a, 0x10, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75,
0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x3a, 0x0a, 0x10, 0x49, 0x6e, 0x63, 0x72, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3b, 0x0a, 0x11, 0x49,
0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x0a, 0x10, 0x44, 0x65, 0x63, 0x72,
0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x22, 0x3b, 0x0a, 0x11, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3b, 0x0a, 0x11, 0x44, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e,
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x22, 0x3a, 0x0a, 0x10, 0x44, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x65, 0x32, 0xa4, 0x02, 0x0a, 0x05, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x2e, 0x0a, 0x03, 0x47,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x65, 0x74, 0x12, 0x11, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65,
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x47, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3b, 0x0a, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x03, 0x53,
0x11, 0x44, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x65, 0x74, 0x12, 0x11, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65,
0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x53, 0x65,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x06, 0x44,
0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x32, 0xa4, 0x02, 0x0a, 0x05, 0x43, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x14, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65,
0x61, 0x63, 0x68, 0x65, 0x12, 0x2e, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x11, 0x2e, 0x63, 0x61, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x63, 0x61,
0x63, 0x68, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x09, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x11, 0x2e, 0x63, 0x61, 0x74, 0x12, 0x17, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d,
0x63, 0x68, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x63, 0x61, 0x63,
0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x68, 0x65, 0x2e, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70,
0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x14, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x09, 0x44, 0x65, 0x63, 0x72, 0x65, 0x6d,
0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x63, 0x72,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x63,
0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a,
0x09, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x63, 0x61, 0x63,
0x68, 0x65, 0x2e, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x49, 0x6e, 0x63, 0x72,
0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x40, 0x0a, 0x09, 0x44, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x63,
0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x70, 0x72,
0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6f, 0x74, 0x6f, 0x3b, 0x63, 0x61, 0x63, 0x68, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x00, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x63, 0x61, 0x63, 0x33,
0x68, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@@ -700,37 +650,35 @@ func file_proto_cache_proto_rawDescGZIP() []byte {
return file_proto_cache_proto_rawDescData return file_proto_cache_proto_rawDescData
} }
var file_proto_cache_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_proto_cache_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_proto_cache_proto_goTypes = []interface{}{ var file_proto_cache_proto_goTypes = []interface{}{
(*Item)(nil), // 0: cache.Item (*GetRequest)(nil), // 0: cache.GetRequest
(*GetRequest)(nil), // 1: cache.GetRequest (*GetResponse)(nil), // 1: cache.GetResponse
(*GetResponse)(nil), // 2: cache.GetResponse (*SetRequest)(nil), // 2: cache.SetRequest
(*SetRequest)(nil), // 3: cache.SetRequest (*SetResponse)(nil), // 3: cache.SetResponse
(*SetResponse)(nil), // 4: cache.SetResponse (*DeleteRequest)(nil), // 4: cache.DeleteRequest
(*DeleteRequest)(nil), // 5: cache.DeleteRequest (*DeleteResponse)(nil), // 5: cache.DeleteResponse
(*DeleteResponse)(nil), // 6: cache.DeleteResponse (*IncrementRequest)(nil), // 6: cache.IncrementRequest
(*IncrementRequest)(nil), // 7: cache.IncrementRequest (*IncrementResponse)(nil), // 7: cache.IncrementResponse
(*IncrementResponse)(nil), // 8: cache.IncrementResponse (*DecrementRequest)(nil), // 8: cache.DecrementRequest
(*DecrementRequest)(nil), // 9: cache.DecrementRequest (*DecrementResponse)(nil), // 9: cache.DecrementResponse
(*DecrementResponse)(nil), // 10: cache.DecrementResponse
} }
var file_proto_cache_proto_depIdxs = []int32{ var file_proto_cache_proto_depIdxs = []int32{
0, // 0: cache.GetResponse.item:type_name -> cache.Item 0, // 0: cache.Cache.Get:input_type -> cache.GetRequest
1, // 1: cache.Cache.Get:input_type -> cache.GetRequest 2, // 1: cache.Cache.Set:input_type -> cache.SetRequest
3, // 2: cache.Cache.Set:input_type -> cache.SetRequest 4, // 2: cache.Cache.Delete:input_type -> cache.DeleteRequest
5, // 3: cache.Cache.Delete:input_type -> cache.DeleteRequest 6, // 3: cache.Cache.Increment:input_type -> cache.IncrementRequest
7, // 4: cache.Cache.Increment:input_type -> cache.IncrementRequest 8, // 4: cache.Cache.Decrement:input_type -> cache.DecrementRequest
9, // 5: cache.Cache.Decrement:input_type -> cache.DecrementRequest 1, // 5: cache.Cache.Get:output_type -> cache.GetResponse
2, // 6: cache.Cache.Get:output_type -> cache.GetResponse 3, // 6: cache.Cache.Set:output_type -> cache.SetResponse
4, // 7: cache.Cache.Set:output_type -> cache.SetResponse 5, // 7: cache.Cache.Delete:output_type -> cache.DeleteResponse
6, // 8: cache.Cache.Delete:output_type -> cache.DeleteResponse 7, // 8: cache.Cache.Increment:output_type -> cache.IncrementResponse
8, // 9: cache.Cache.Increment:output_type -> cache.IncrementResponse 9, // 9: cache.Cache.Decrement:output_type -> cache.DecrementResponse
10, // 10: cache.Cache.Decrement:output_type -> cache.DecrementResponse 5, // [5:10] is the sub-list for method output_type
6, // [6:11] is the sub-list for method output_type 0, // [0:5] is the sub-list for method input_type
1, // [1:6] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee
1, // [1:1] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name
0, // [0:1] is the sub-list for field type_name
} }
func init() { file_proto_cache_proto_init() } func init() { file_proto_cache_proto_init() }
@@ -740,18 +688,6 @@ func file_proto_cache_proto_init() {
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proto_cache_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Item); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_cache_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetRequest); i { switch v := v.(*GetRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -763,7 +699,7 @@ func file_proto_cache_proto_init() {
return nil return nil
} }
} }
file_proto_cache_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetResponse); i { switch v := v.(*GetResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -775,7 +711,7 @@ func file_proto_cache_proto_init() {
return nil return nil
} }
} }
file_proto_cache_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetRequest); i { switch v := v.(*SetRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -787,7 +723,7 @@ func file_proto_cache_proto_init() {
return nil return nil
} }
} }
file_proto_cache_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetResponse); i { switch v := v.(*SetResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -799,7 +735,7 @@ func file_proto_cache_proto_init() {
return nil return nil
} }
} }
file_proto_cache_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteRequest); i { switch v := v.(*DeleteRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -811,7 +747,7 @@ func file_proto_cache_proto_init() {
return nil return nil
} }
} }
file_proto_cache_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteResponse); i { switch v := v.(*DeleteResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -823,7 +759,7 @@ func file_proto_cache_proto_init() {
return nil return nil
} }
} }
file_proto_cache_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IncrementRequest); i { switch v := v.(*IncrementRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -835,7 +771,7 @@ func file_proto_cache_proto_init() {
return nil return nil
} }
} }
file_proto_cache_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IncrementResponse); i { switch v := v.(*IncrementResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -847,7 +783,7 @@ func file_proto_cache_proto_init() {
return nil return nil
} }
} }
file_proto_cache_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DecrementRequest); i { switch v := v.(*DecrementRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -859,7 +795,7 @@ func file_proto_cache_proto_init() {
return nil return nil
} }
} }
file_proto_cache_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { file_proto_cache_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DecrementResponse); i { switch v := v.(*DecrementResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -878,7 +814,7 @@ func file_proto_cache_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_cache_proto_rawDesc, RawDescriptor: file_proto_cache_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 11, NumMessages: 10,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@@ -12,15 +12,6 @@ service Cache {
rpc Decrement(DecrementRequest) returns (DecrementResponse) {} 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 // Get an item from the cache by key
message GetRequest { message GetRequest {
// The key to retrieve // The key to retrieve
@@ -28,8 +19,12 @@ message GetRequest {
} }
message GetResponse { message GetResponse {
// The item in the cache // The key
Item item = 1; string key = 1;
// The value
string value = 2;
// Time to live in seconds
int64 ttl = 3;
} }
// Set an item in the cache // Set an item in the cache