Documentation
¶
Index ¶
- type CacheServer
- func (s *CacheServer) Add(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Append(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Call(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Cas(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Decrement(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Delete(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) FlushAll(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Get(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Gets(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Increment(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Prepend(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Replace(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Set(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
- func (s *CacheServer) Start()
- func (s *CacheServer) Stop()
- func (s *CacheServer) Stream(stream pb.Cache_StreamServer) error
- func (s *CacheServer) Touch(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheServer ¶
type CacheServer struct {
// contains filtered or unexported fields
}
CacheServer encapsulates the cache server things.
func New ¶
func New(address string, maxEntries int) (*CacheServer, error)
New returns a new instance of the server. It takes host:port and maxEntries arguments, which defines the max number of entries allowed in the cache. Set to 0 for unlimited.
func NewWithListener ¶
func NewWithListener(listener net.Listener, maxEntries int) *CacheServer
NewWithListener returns a new instance of the server given an initialized listener and maxEntries for the cache.
func (*CacheServer) Add ¶
func (s *CacheServer) Add(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Add adds a key/value pair to the cache.
func (*CacheServer) Append ¶
func (s *CacheServer) Append(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Append appends the value to the current value for the key.
func (*CacheServer) Call ¶
func (s *CacheServer) Call(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Call calls the cache operation in in.Operation
func (*CacheServer) Cas ¶
func (s *CacheServer) Cas(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Cas does a "check and set" or "compare and swap" operation. If the given key exists and the currently stored CAS value matches the one supplied, the value is stored.
func (*CacheServer) Decrement ¶
func (s *CacheServer) Decrement(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Decrement decrements the value for the given key.
func (*CacheServer) Delete ¶
func (s *CacheServer) Delete(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Delete deletes a key/value pair from the cache.
func (*CacheServer) FlushAll ¶
func (s *CacheServer) FlushAll(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
FlushAll deletes all key/value pairs from the cache.
func (*CacheServer) Get ¶
func (s *CacheServer) Get(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Get gets a key/value pair from the cache.
func (*CacheServer) Gets ¶
func (s *CacheServer) Gets(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Gets gets a key/value pair from the cache and includes its CAS value.
func (*CacheServer) Increment ¶
func (s *CacheServer) Increment(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Increment increments the value for key.
func (*CacheServer) Prepend ¶
func (s *CacheServer) Prepend(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Prepend prepends the value to the current value for the key.
func (*CacheServer) Replace ¶
func (s *CacheServer) Replace(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Replace replaces a key/value pair in the cache.
func (*CacheServer) Set ¶
func (s *CacheServer) Set(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Set stores a key/value pair in the cache.
func (*CacheServer) Stream ¶
func (s *CacheServer) Stream(stream pb.Cache_StreamServer) error
Stream ...
func (*CacheServer) Touch ¶
func (s *CacheServer) Touch(ctx context.Context, in *pb.CacheRequest) (*pb.CacheResponse, error)
Touch updates the key/value pair's cas and ttl.