stuk

package module
v0.0.0-...-6874237 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: MIT Imports: 3 Imported by: 0

README

stuk

带过期功能的map。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func New

func New(expire time.Duration, timeoutCallback TimeoutCallback) *Cache

New 新建map

func (Cache) Delete

func (c Cache) Delete(k uint64)

Delete 删除键值对

func (Cache) Get

func (c Cache) Get(k uint64) any

Get 读取键值对.返回nil表示读取失败

func (Cache) Pull

func (c Cache) Pull(k uint64) any

Pull 读取键值对并刷新过期时间.返回nil表示读取失败

func (Cache) Set

func (c Cache) Set(k uint64, v any)

Set 设置键值对

type TimeoutCallback

type TimeoutCallback func(k uint64, v any)

TimeoutCallback 超时回调函数

Jump to

Keyboard shortcuts

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