resources

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNoCache = errors.New("no cache")
)

Functions

func ReplaceCacher

func ReplaceCacher(caches ...ICache)

Types

type ICache

type ICache interface {
	Set(ctx context.Context, key string, value []byte, expiration time.Duration) error
	SetNX(ctx context.Context, key string, value []byte, expiration time.Duration) (bool, error)
	DecrBy(ctx context.Context, key string, decrement int64) (int64, error)
	IncrBy(ctx context.Context, key string, decrement int64) (int64, error)
	Get(ctx context.Context, key string) ([]byte, error)
	GetDel(ctx context.Context, key string) ([]byte, error)
	Del(ctx context.Context, keys ...string) (int64, error)
	Close() error
}

func Cacher

func Cacher() ICache

type NoCache

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

func NewCacher

func NewCacher() *NoCache

func (*NoCache) Close

func (n *NoCache) Close() error

func (*NoCache) DecrBy

func (n *NoCache) DecrBy(ctx context.Context, key string, decrement int64) (int64, error)

func (*NoCache) Del

func (n *NoCache) Del(ctx context.Context, keys ...string) (int64, error)

func (*NoCache) Get

func (n *NoCache) Get(ctx context.Context, key string) ([]byte, error)

func (*NoCache) GetDel

func (n *NoCache) GetDel(ctx context.Context, key string) ([]byte, error)

func (*NoCache) IncrBy

func (n *NoCache) IncrBy(ctx context.Context, key string, decrement int64) (int64, error)

func (*NoCache) Set

func (n *NoCache) Set(ctx context.Context, key string, value []byte, expiration time.Duration) error

func (*NoCache) SetNX

func (n *NoCache) SetNX(ctx context.Context, key string, value []byte, expiration time.Duration) (bool, error)

Jump to

Keyboard shortcuts

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