adapter

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGroupName = "default" // Default configuration group name.
	DistCacheName    = "distCache"
)

Variables

This section is empty.

Functions

func SetConfig

func SetConfig(config *Config, name ...string)

SetConfig sets the global configuration for specified group. If `name` is not passed, it sets configuration for the default group name.

Types

type Config

type Config struct {
	Dir string
}

Config 磁盘缓存配置

type Dist

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

func New

func New(name ...string) *Dist

func NewDist

func NewDist() *Dist

func (*Dist) Clear

func (d *Dist) Clear(ctx context.Context) error

func (*Dist) Close

func (d *Dist) Close(ctx context.Context) error

func (*Dist) Contains

func (d *Dist) Contains(ctx context.Context, key interface{}) (b bool, err error)

func (*Dist) Data

func (d *Dist) Data(ctx context.Context) (data map[interface{}]interface{}, err error)

func (*Dist) Get

func (d *Dist) Get(ctx context.Context, key interface{}) (value *gvar.Var, err error)

func (*Dist) GetExpire

func (d *Dist) GetExpire(ctx context.Context, key interface{}) (duration time.Duration, err error)

func (*Dist) GetOrSet

func (d *Dist) GetOrSet(ctx context.Context, key interface{}, value interface{}, duration time.Duration) (result *gvar.Var, err error)

func (*Dist) GetOrSetFunc

func (d *Dist) GetOrSetFunc(ctx context.Context, key interface{}, f gcache.Func, duration time.Duration) (result *gvar.Var, err error)

func (*Dist) GetOrSetFuncLock

func (d *Dist) GetOrSetFuncLock(ctx context.Context, key interface{}, f gcache.Func, duration time.Duration) (result *gvar.Var, err error)

func (*Dist) Keys

func (d *Dist) Keys(ctx context.Context) (keys []interface{}, err error)

func (*Dist) Remove

func (d *Dist) Remove(ctx context.Context, keys ...interface{}) (lastValue *gvar.Var, err error)

func (*Dist) Set

func (d *Dist) Set(ctx context.Context, key interface{}, value interface{}, duration time.Duration) error

func (*Dist) SetIfNotExist

func (d *Dist) SetIfNotExist(ctx context.Context, key interface{}, value interface{}, duration time.Duration) (ok bool, err error)

func (*Dist) SetIfNotExistFunc

func (d *Dist) SetIfNotExistFunc(ctx context.Context, key interface{}, f gcache.Func, duration time.Duration) (ok bool, err error)

func (*Dist) SetIfNotExistFuncLock

func (d *Dist) SetIfNotExistFuncLock(ctx context.Context, key interface{}, f gcache.Func, duration time.Duration) (ok bool, err error)

func (*Dist) SetMap

func (d *Dist) SetMap(ctx context.Context, data map[interface{}]interface{}, duration time.Duration) error

func (*Dist) Size

func (d *Dist) Size(ctx context.Context) (size int, err error)

func (*Dist) Update

func (d *Dist) Update(ctx context.Context, key interface{}, value interface{}) (oldValue *gvar.Var, exist bool, err error)

func (*Dist) UpdateExpire

func (d *Dist) UpdateExpire(ctx context.Context, key interface{}, duration time.Duration) (oldDuration time.Duration, err error)

func (*Dist) Values

func (d *Dist) Values(ctx context.Context) (values []interface{}, err error)

Jump to

Keyboard shortcuts

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