cache

package
v0.0.0-...-2af310e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_cache_proto protoreflect.FileDescriptor

Functions

func NewCacheEndpoints

func NewCacheEndpoints() []*api.Endpoint

func RegisterCacheHandler

func RegisterCacheHandler(s server.Server, hdlr CacheHandler, opts ...server.HandlerOption) error

Types

type CacheService

type CacheService interface {
	Get(ctx context.Context, in *GetRequest, opts ...client.CallOption) (*GetResponse, error)
	Set(ctx context.Context, in *SetRequest, opts ...client.CallOption) (*SetResponse, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
	Increment(ctx context.Context, in *IncrementRequest, opts ...client.CallOption) (*IncrementResponse, error)
	Decrement(ctx context.Context, in *DecrementRequest, opts ...client.CallOption) (*DecrementResponse, error)
	ListKeys(ctx context.Context, in *ListKeysRequest, opts ...client.CallOption) (*ListKeysResponse, error)
}

func NewCacheService

func NewCacheService(name string, c client.Client) CacheService

type DecrementRequest

type DecrementRequest struct {

	// The key to decrement
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// The amount to decrement the value by
	Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

Decrement a value (if it's a number). If key not found it is equivalent to set.

func (*DecrementRequest) Descriptor deprecated

func (*DecrementRequest) Descriptor() ([]byte, []int)

Deprecated: Use DecrementRequest.ProtoReflect.Descriptor instead.

func (*DecrementRequest) GetKey

func (x *DecrementRequest) GetKey() string

func (*DecrementRequest) GetValue

func (x *DecrementRequest) GetValue() int64

func (*DecrementRequest) ProtoMessage

func (*DecrementRequest) ProtoMessage()

func (*DecrementRequest) ProtoReflect

func (x *DecrementRequest) ProtoReflect() protoreflect.Message

func (*DecrementRequest) Reset

func (x *DecrementRequest) Reset()

func (*DecrementRequest) String

func (x *DecrementRequest) String() string

type DecrementResponse

type DecrementResponse struct {

	// The key decremented
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// The new value
	Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*DecrementResponse) Descriptor deprecated

func (*DecrementResponse) Descriptor() ([]byte, []int)

Deprecated: Use DecrementResponse.ProtoReflect.Descriptor instead.

func (*DecrementResponse) GetKey

func (x *DecrementResponse) GetKey() string

func (*DecrementResponse) GetValue

func (x *DecrementResponse) GetValue() int64

func (*DecrementResponse) ProtoMessage

func (*DecrementResponse) ProtoMessage()

func (*DecrementResponse) ProtoReflect

func (x *DecrementResponse) ProtoReflect() protoreflect.Message

func (*DecrementResponse) Reset

func (x *DecrementResponse) Reset()

func (*DecrementResponse) String

func (x *DecrementResponse) String() string

type DeleteRequest

type DeleteRequest struct {

	// The key to delete
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

Delete a value from the cache. If key not found a success response is returned.

func (*DeleteRequest) Descriptor deprecated

func (*DeleteRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetKey

func (x *DeleteRequest) GetKey() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

func (x *DeleteRequest) ProtoReflect() protoreflect.Message

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type DeleteResponse

type DeleteResponse struct {

	// Returns "ok" if successful
	Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteResponse) Descriptor deprecated

func (*DeleteResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) GetStatus

func (x *DeleteResponse) GetStatus() string

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

func (x *DeleteResponse) ProtoReflect() protoreflect.Message

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type GetRequest

type GetRequest struct {

	// The key to retrieve
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

Get an item from the cache by key. If key is not found, an empty response is returned.

func (*GetRequest) Descriptor deprecated

func (*GetRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetKey

func (x *GetRequest) GetKey() string

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

func (x *GetRequest) ProtoReflect() protoreflect.Message

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type GetResponse

type GetResponse struct {

	// 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"`
	// contains filtered or unexported fields
}

func (*GetResponse) Descriptor deprecated

func (*GetResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetKey

func (x *GetResponse) GetKey() string

func (*GetResponse) GetTtl

func (x *GetResponse) GetTtl() int64

func (*GetResponse) GetValue

func (x *GetResponse) GetValue() string

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect

func (x *GetResponse) ProtoReflect() protoreflect.Message

func (*GetResponse) Reset

func (x *GetResponse) Reset()

func (*GetResponse) String

func (x *GetResponse) String() string

type IncrementRequest

type IncrementRequest struct {

	// The key to increment
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// The amount to increment the value by
	Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

Increment a value (if it's a number). If key not found it is equivalent to set.

func (*IncrementRequest) Descriptor deprecated

func (*IncrementRequest) Descriptor() ([]byte, []int)

Deprecated: Use IncrementRequest.ProtoReflect.Descriptor instead.

func (*IncrementRequest) GetKey

func (x *IncrementRequest) GetKey() string

func (*IncrementRequest) GetValue

func (x *IncrementRequest) GetValue() int64

func (*IncrementRequest) ProtoMessage

func (*IncrementRequest) ProtoMessage()

func (*IncrementRequest) ProtoReflect

func (x *IncrementRequest) ProtoReflect() protoreflect.Message

func (*IncrementRequest) Reset

func (x *IncrementRequest) Reset()

func (*IncrementRequest) String

func (x *IncrementRequest) String() string

type IncrementResponse

type IncrementResponse struct {

	// The key incremented
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// The new value
	Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*IncrementResponse) Descriptor deprecated

func (*IncrementResponse) Descriptor() ([]byte, []int)

Deprecated: Use IncrementResponse.ProtoReflect.Descriptor instead.

func (*IncrementResponse) GetKey

func (x *IncrementResponse) GetKey() string

func (*IncrementResponse) GetValue

func (x *IncrementResponse) GetValue() int64

func (*IncrementResponse) ProtoMessage

func (*IncrementResponse) ProtoMessage()

func (*IncrementResponse) ProtoReflect

func (x *IncrementResponse) ProtoReflect() protoreflect.Message

func (*IncrementResponse) Reset

func (x *IncrementResponse) Reset()

func (*IncrementResponse) String

func (x *IncrementResponse) String() string

type ListKeysRequest

type ListKeysRequest struct {
	// contains filtered or unexported fields
}

List all the available keys

func (*ListKeysRequest) Descriptor deprecated

func (*ListKeysRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListKeysRequest.ProtoReflect.Descriptor instead.

func (*ListKeysRequest) ProtoMessage

func (*ListKeysRequest) ProtoMessage()

func (*ListKeysRequest) ProtoReflect

func (x *ListKeysRequest) ProtoReflect() protoreflect.Message

func (*ListKeysRequest) Reset

func (x *ListKeysRequest) Reset()

func (*ListKeysRequest) String

func (x *ListKeysRequest) String() string

type ListKeysResponse

type ListKeysResponse struct {
	Keys []string `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
	// contains filtered or unexported fields
}

func (*ListKeysResponse) Descriptor deprecated

func (*ListKeysResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListKeysResponse.ProtoReflect.Descriptor instead.

func (*ListKeysResponse) GetKeys

func (x *ListKeysResponse) GetKeys() []string

func (*ListKeysResponse) ProtoMessage

func (*ListKeysResponse) ProtoMessage()

func (*ListKeysResponse) ProtoReflect

func (x *ListKeysResponse) ProtoReflect() protoreflect.Message

func (*ListKeysResponse) Reset

func (x *ListKeysResponse) Reset()

func (*ListKeysResponse) String

func (x *ListKeysResponse) String() string

type SetRequest

type SetRequest struct {

	// The key to update
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// The value to set
	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"`
	// contains filtered or unexported fields
}

Set an item in the cache. Overwrites any existing value already set.

func (*SetRequest) Descriptor deprecated

func (*SetRequest) Descriptor() ([]byte, []int)

Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.

func (*SetRequest) GetKey

func (x *SetRequest) GetKey() string

func (*SetRequest) GetTtl

func (x *SetRequest) GetTtl() int64

func (*SetRequest) GetValue

func (x *SetRequest) GetValue() string

func (*SetRequest) ProtoMessage

func (*SetRequest) ProtoMessage()

func (*SetRequest) ProtoReflect

func (x *SetRequest) ProtoReflect() protoreflect.Message

func (*SetRequest) Reset

func (x *SetRequest) Reset()

func (*SetRequest) String

func (x *SetRequest) String() string

type SetResponse

type SetResponse struct {

	// Returns "ok" if successful
	Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*SetResponse) Descriptor deprecated

func (*SetResponse) Descriptor() ([]byte, []int)

Deprecated: Use SetResponse.ProtoReflect.Descriptor instead.

func (*SetResponse) GetStatus

func (x *SetResponse) GetStatus() string

func (*SetResponse) ProtoMessage

func (*SetResponse) ProtoMessage()

func (*SetResponse) ProtoReflect

func (x *SetResponse) ProtoReflect() protoreflect.Message

func (*SetResponse) Reset

func (x *SetResponse) Reset()

func (*SetResponse) String

func (x *SetResponse) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL