cache

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeNode = "caches"
)

Variables

View Source
var Nil = errors.New("Nil")

Functions

func Deregister

func Deregister(name string)

Deregister 清理配置适配器

func NewBuilder

func NewBuilder() container.StandardBuilder

func Register

func Register(resolver cacheResover)

RegisterCache 注册配置文件适配器

Types

type ICache

type ICache interface {
	Name() string
	Get(ctx context.Context, key string) (string, error)
	Set(ctx context.Context, key string, val interface{}, expire int) error
	Del(ctx context.Context, key string) error
	HashGet(ctx context.Context, hk, key string) (string, error)
	HashSet(ctx context.Context, hk, key string, val string) (bool, error)
	HashDel(ctx context.Context, hk, key string) error
	HashMGet(ctx context.Context, hk string, key ...string) (map[string]interface{}, error)
	HashSetAll(ctx context.Context, hk string, val map[string]interface{}) (bool, error)
	HashExists(ctx context.Context, hk, key string) (bool, error)
	Increase(ctx context.Context, key string) (int64, error)
	Decrease(ctx context.Context, key string) (int64, error)
	Expire(ctx context.Context, key string, expire int) error
	Exists(ctx context.Context, key string) (bool, error)
	GetImpl() interface{}
}

type Option added in v0.4.3

type Option func(*Options)

Option 配置选项

func WithDBIndex added in v0.4.3

func WithDBIndex(idx int) Option

func WithOption added in v0.4.3

func WithOption(key string, val any) Option

func WithPoolSize added in v0.4.3

func WithPoolSize(size int) Option

type Options added in v0.4.3

type Options struct {
	CfgData map[string]any
}

type StandardCache

type StandardCache interface {
	GetCache(name string, opts ...Option) (q ICache)
}

StandardCache cache

func NewStandardCache

func NewStandardCache(c container.Container) StandardCache

NewStandardCache 创建cache

Jump to

Keyboard shortcuts

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