localCache

package
v0.1.76 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvictFunc

type EvictFunc func(key string, val any)

type LocalCache

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

LocalCache local cache build in map

func New

func New(opts ...Opt) *LocalCache

func (*LocalCache) Close

func (l *LocalCache) Close() error

func (*LocalCache) Delete

func (l *LocalCache) Delete(ctx context.Context, key string) error

func (*LocalCache) Get

func (l *LocalCache) Get(ctx context.Context, key string) (any, error)

func (*LocalCache) Set

func (l *LocalCache) Set(ctx context.Context, key string, val any, expireTime time.Duration) error

type Opt

type Opt func(c *LocalCache)

func WithCheckInterval

func WithCheckInterval(interval time.Duration) Opt

func WithCheckLoopMaxCheckCount

func WithCheckLoopMaxCheckCount(maxCount int) Opt

func WithEvictFunc

func WithEvictFunc(evictFunc EvictFunc) Opt

Jump to

Keyboard shortcuts

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