server

package
v0.0.0-...-4dd3b10 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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

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

Call calls the cache operation in in.Operation

func (*CacheServer) Cas

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

Get gets a key/value pair from the cache.

func (*CacheServer) Gets

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

Set stores a key/value pair in the cache.

func (*CacheServer) Start

func (s *CacheServer) Start()

Start starts the cache server.

func (*CacheServer) Stop

func (s *CacheServer) Stop()

Stop tries to gracefull stop the server.

func (*CacheServer) Stream

func (s *CacheServer) Stream(stream pb.Cache_StreamServer) error

Stream ...

func (*CacheServer) Touch

Touch updates the key/value pair's cas and ttl.

Jump to

Keyboard shortcuts

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