kv

package
v0.0.0-...-a253b9f Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(key interface{})

Delete 删除KV中指定的元素

func Exists

func Exists(key interface{}) bool

Exists 判断元素是否在集合中且未过期

func Get

func Get(key interface{}) interface{}

Get 获取KV中的指定元素

func Set

func Set(key interface{}, value interface{}, ttl time.Duration)

Set 往集合中添加元素

Types

type Item

type Item struct {
	Value    interface{}
	ExpireAt time.Time
}

Item 集合中的元素,包含值和过期时间

type KV

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

KV 一个支持元素具有声明周期的Set集合

func GetKV

func GetKV() *KV

GetKV 获取KV实例

Jump to

Keyboard shortcuts

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