cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 2 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 struct {
	// contains filtered or unexported fields
}

func New

func New() *Cache

func (*Cache) Del

func (c *Cache) Del(key string) bool

func (*Cache) Get

func (c *Cache) Get(key string) any

func (*Cache) Set

func (c *Cache) Set(key string, value any, duration time.Duration) bool

func (*Cache) StartCleanup

func (c *Cache) StartCleanup()

启动任务,清理过期缓存

func (*Cache) TTL

func (c *Cache) TTL(key string) time.Duration

type CacheItem

type CacheItem struct {
	Value      any
	Expiration int64
}

func (*CacheItem) Expired

func (item *CacheItem) Expired() bool

Jump to

Keyboard shortcuts

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