blockCache

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: AGPL-3.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResultWrapper

func NewResultWrapper(result interface{}, err error) *resultWrapper

Types

type Action

type Action func() ActionResult

type ActionResult

type ActionResult interface {
	Result() interface{}
	Err() error
}

type BlockCache

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

func NewBlockCache

func NewBlockCache(blockSize uint32, lruSize uint32, hashFuncs ...HashFunc) *BlockCache

NewBlockCache blockSize 为0表示不使用block,退化为单纯的lru,同一请求有可能执行多次,并覆盖lru缓存

func (*BlockCache) WithCacheDo

func (b *BlockCache) WithCacheDo(key string, f Action) ActionResult

type HashFunc

type HashFunc func(b []byte) uint32

Jump to

Keyboard shortcuts

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