// protoToItem converts a protocol buffer item to a Go struct. func protoToItem(p *pb.MemcacheGetResponse_Item) *Item { return &Item{ Key: string(p.Key), Value: p.Value, Flags: p.GetFlags(), casID: p.GetCasId(), } }
// protoToItem converts a protocol buffer item to a Go struct. func protoToItem(p *pb.MemcacheGetResponse_Item) *Item { var expiration time.Duration sec := p.GetExpiresInSeconds() if sec > 0 && sec < secondsIn30Years { expiration = time.Duration(sec) * time.Second } return &Item{ Key: string(p.Key), Value: p.Value, Flags: p.GetFlags(), Expiration: expiration, casID: p.GetCasId(), } }