inmemory

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 3 Imported by: 0

README

基于内存的简易存储

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotExist = errors.New("does NOT found")

ErrNotExist key不存在

Functions

func NDel added in v0.0.4

func NDel(name string)

NDel 尝试删除某个key 会优先检查key是否存在,如果key不存在,则直接返回

func NGet

func NGet(name string) (interface{}, error)

NGet 通过某个KEY获取其缓存的数据

func NSet

func NSet(name string, v interface{})

NSet 设置某个值的缓存

func New

func New(opts ...Option) *inmemory

New 其构造函数

Types

type Option

type Option func(o *Options)

Option 组件设置函数

func WithMaxLife

func WithMaxLife(d time.Duration) Option

WithMaxLife 设置最大过期时间 由于是惰性删除,会在Get的时候用于判定

type Options

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

Options 组件选项集合

Jump to

Keyboard shortcuts

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