cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(ctx context.Context, key string, val interface{}, expiration time.Duration) error
	Get(ctx context.Context, key string) (interface{}, error)
	GetDel(ctx context.Context, key string) (interface{}, error)
	Scan(ctx context.Context, key string, val interface{}) error
	Delete(ctx context.Context, keys ...string) error
	Options() Options
	Ping(ctx context.Context) error
	Close(ctx context.Context) error
}

Cache 定义cache驱动接口

func NewCache

func NewCache(opts ...Option) Cache

NewCache returns a new cache.

type Option

type Option func(o *Options)

func WithDB

func WithDB(db int) Option

func WithEndpoint

func WithEndpoint(endpoint string) Option

func WithMinIdle

func WithMinIdle(idle int) Option

func WithOptions

func WithOptions(op Options) Option

func WithPoolSize

func WithPoolSize(size int) Option

func WithPwd

func WithPwd(pwd string) Option

type Options

type Options struct {
	Endpoint string
	Password string
	Db       int
	PoolSize int
	MinIdle  int
}

Jump to

Keyboard shortcuts

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