cachex

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Provider = wire.NewSet()

Functions

This section is empty.

Types

type Store

type Store interface {
	Get(key string) (interface{}, bool)
	Set(key string, val interface{})
}

Store 定义接口

func BigCache

func BigCache(
	expirationTime time.Duration,
	cleanupInterval time.Duration,
	shards int,
	onEvicted func(key string, entry []byte),
	marshal func(key string, obj interface{}) ([]byte, error),
	unmarshal func(key string, data []byte) (interface{}, error),
	errHandler func(err error),
) (Store, error)

func LRUCache

func LRUCache(
	size uint,
	onEvicted func(key interface{}, value interface{}),
) (Store, error)

func SampleCache

func SampleCache() Store

func TTLCache

func TTLCache(
	expirationTime, cleanupInterval time.Duration,
	shards int,
	onEvicted func(string, interface{}),
	ttl func(key string) time.Duration,
) Store

Jump to

Keyboard shortcuts

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