datacache

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 4 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[V any] struct {
	// contains filtered or unexported fields
}

Cache 本 cache 目前不包含定时清理,请在有限场景使用

func (*Cache[V]) Clear added in v0.1.1

func (c *Cache[V]) Clear()

func (*Cache[V]) Delete added in v0.2.2

func (c *Cache[V]) Delete(key string)

func (*Cache[V]) GetOrLoad

func (c *Cache[V]) GetOrLoad(
	key string,
	getData func() (V, error),
	timeout time.Duration,
) (value V)

func (*Cache[V]) GetOrLoadE

func (c *Cache[V]) GetOrLoadE(
	key string,
	getData func() (V, error),
	timeout time.Duration,
) (V, error)

GetOrLoadE 核心调用方法(满足您要求的参数形式)

Jump to

Keyboard shortcuts

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