groupcache

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadCacheValue = errors.New("sha.groupcache: bad cache")
View Source
var ErrEmpty = errors.New("sha.groupcache: empty")
View Source
var ErrRetryAfter = internal.ErrRetryAfter
View Source
var StdJsonConvertor = _StdJsonConvertor{}

Functions

This section is empty.

Types

type Convertor

type Convertor interface {
	Encode(v interface{}) ([]byte, error)
	Decode(v []byte, dist interface{}) error
}

type DataLoader

type DataLoader func(ctx context.Context, args NamedArgs) (ret interface{}, err error)

type Expires

type Expires struct {
	Default utils.TomlDuration `json:"default" toml:"default"`
	Missing utils.TomlDuration `json:"missing" toml:"missing"`
}

type Group

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

func New

func New(name string, expires *Expires, maxWait int32) *Group

func Simple

func Simple() *Group

func (*Group) Configure

func (g *Group) Configure(name string, expires *Expires, maxWait int32) *Group

func (*Group) Do

func (g *Group) Do(ctx context.Context, loaderName string, dist interface{}, args NamedArgs) error

func (*Group) DoWithExpires

func (g *Group) DoWithExpires(ctx context.Context, loaderName string, dist interface{}, args NamedArgs, expires *Expires) error

dist must be a pointer

func (*Group) MakeKey

func (g *Group) MakeKey(loaderName, argsName string) string

func (*Group) Register

func (g *Group) Register(name string, loader DataLoader) *Group

func (*Group) SetConvertor

func (g *Group) SetConvertor(c Convertor) *Group

func (*Group) SetRedisStorage

func (g *Group) SetRedisStorage(r redis.Cmdable) *Group

func (*Group) SetStorage

func (g *Group) SetStorage(s Storage) *Group

func (*Group) SetStoragePrefix

func (g *Group) SetStoragePrefix(prefix string) *Group

type NamedArgs

type NamedArgs interface {
	Name() string
}

type Storage

type Storage interface {
	Set(ctx context.Context, k string, v []byte, expires time.Duration)
	Get(ctx context.Context, k string) ([]byte, bool)
	Del(ctx context.Context, keys ...string)
}

func RedisStorage

func RedisStorage(cmd redis.Cmdable) Storage

Jump to

Keyboard shortcuts

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