cacheTool

package
v1.1.885 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCache

func WithCache[T any](
	ctx context.Context,
	cache *redisCache.Cache,
	cacheKey string,
	ttl time.Duration,
	fetchFunc func(ctx context.Context) (T, error),
	optChains ...*Option,
) (T, error)

WithCache cache encapsulation, slice please use SliceWrapper WithCache(ctx,cache,cacheKey,ttl,func(ctx context.Context) (*SliceWrapper[T],err)

Types

type Option

type Option struct {
	NoCacheMongoNoDocuments bool
	SetXX                   bool
	SetNX                   bool
	SkipLocalCache          bool
}

type SliceWrapper added in v0.7.8

type SliceWrapper[T any] struct {
	L []T `json:"l" msgpack:"l"`
}

Jump to

Keyboard shortcuts

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