mycache

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: BSD-3-Clause Imports: 5 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 {
	Get(k string) (any, bool)             //取值
	Set(k string, v any, d time.Duration) //设置值
	Del(k string)                         //删除指定Key
	HasKey(k string) bool
	UpdateExpired(k string, d time.Duration) error //更新值 时效
	UpdateValue(k string, v any) error
	SaveFile(fname string) error
	LoadFile(fname string) error
	Flush()
}

func NewCache

func NewCache() Cache

type Item

type Item struct {
	Object     any
	Expiration int64 //表示用效的时间Nano ,0表示没有到期时间
}

func (Item) Expired

func (self Item) Expired() bool

Jump to

Keyboard shortcuts

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