memory

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Nil = errors.New("memory cache: nil")
)

*

@author : Jerbe - The porter from Earth
@time : 2023/9/8 22:06
@describe :

Functions

func Scan

func Scan(b []byte, v interface{}) error

Scan nolint:gocyclo

func ScanSlice

func ScanSlice(data []string, slice interface{}) error

ScanSlice 扫描切片

Types

type Cache

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

func (*Cache) Exists

func (mc *Cache) Exists(ctx context.Context, key string) (bool, error)

Exists 判断某个Key是否存在

func (*Cache) Get

func (mc *Cache) Get(ctx context.Context, key string) (string, error)

Get 获取数据

func (*Cache) MGet

func (mc *Cache) MGet(ctx context.Context, keys ...string) ([]any, error)

MGet 获取数据

func (*Cache) MGetAndScan

func (mc *Cache) MGetAndScan(ctx context.Context, dst any, keys ...string) error

MGet 获取数据

func (*Cache) Set

func (mc *Cache) Set(ctx context.Context, key string, data any, expiration time.Duration) error

Set 设置数据

func (*Cache) SetNX

func (mc *Cache) SetNX(ctx context.Context, key string, data any, expiration time.Duration) error

SetNX 设置数据,如果key不存在的话

type StoreType

type StoreType string
const (
	StoreTypeString    StoreType = "String"
	StoreTypeHash      StoreType = "Hash"
	StoreTypeList      StoreType = "List"
	StoreTypeSet       StoreType = "Set"
	StoreTypeSortedSet StoreType = "SortedSet"
)

Jump to

Keyboard shortcuts

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