datacache

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: MIT Imports: 3 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]) GetOrLoad

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

func (*Cache[V]) GetOrLoadE added in v0.0.8

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