lru

package
v0.0.0-...-8d187f3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	Max     int `statsd:"max-bucket"` // 统计Get扫描到的最大值
	Size    int `statsd:"size"`
	AvgScan int `statsd:"avg-scan"` // 平均扫描次数
	Hit     int `statsd:"hit"`
	Miss    int `statsd:"miss"`
	// contains filtered or unexported fields
}

type DoubleKeyLRUCounter

type DoubleKeyLRUCounter struct {
	Max            int `statsd:"max-bucket"`       // 目前仅统计Get扫描到的最大冲突值
	MaxShortBucket int `statsd:"max-short-bucket"` // 目前仅统计GetByShortKey扫描到的最大冲突值
	Size           int `statsd:"size"`
	MaxLongBucket  int `statsd:"max-long-bucket"` // 目前通过shortKey删除的含有最多的成员数值
	AvgScan        int `statsd:"avg-scan"`        // 平均扫描次数
	Hit            int `statsd:"hit"`
	Miss           int `statsd:"miss"`
	// contains filtered or unexported fields
}

type U128LRU

type U128LRU struct {
	utils.Closable
	// contains filtered or unexported fields
}

注意:不是线程安全的

func NewU128LRU

func NewU128LRU(module string, hashSlots, capacity int, opts ...stats.OptionStatTags) *U128LRU

func NewU128LRUNoStats

func NewU128LRUNoStats(module string, hashSlots, capacity int) *U128LRU

func (*U128LRU) Add

func (m *U128LRU) Add(key0, key1 uint64, value interface{})

func (*U128LRU) AddOrGet

func (m *U128LRU) AddOrGet(key0, key1 uint64, value interface{}) *interface{}

func (*U128LRU) Clear

func (m *U128LRU) Clear()

func (*U128LRU) Close

func (m *U128LRU) Close() error

func (*U128LRU) Get

func (m *U128LRU) Get(key0, key1 uint64, peek bool) (interface{}, bool)

func (*U128LRU) GetCollisionChain

func (m *U128LRU) GetCollisionChain() []byte

func (*U128LRU) GetCounter

func (m *U128LRU) GetCounter() interface{}

func (*U128LRU) ID

func (m *U128LRU) ID() string

func (*U128LRU) KeySize

func (m *U128LRU) KeySize() int

func (*U128LRU) NoStats

func (m *U128LRU) NoStats() *U128LRU

func (*U128LRU) Remove

func (m *U128LRU) Remove(key0, key1 uint64)

func (*U128LRU) SetCollisionChainDebugThreshold

func (m *U128LRU) SetCollisionChainDebugThreshold(t int)

func (*U128LRU) Size

func (m *U128LRU) Size() int

func (*U128LRU) Walk

func (m *U128LRU) Walk(callback walkCallback)

type U128U64DoubleKeyLRU

type U128U64DoubleKeyLRU struct {
	utils.Closable
	// contains filtered or unexported fields
}

注意:不是线程安全的

func NewU128U64DoubleKeyLRU

func NewU128U64DoubleKeyLRU(module string, hashSlots, relationHashSlots, capacity int, opts ...stats.OptionStatTags) *U128U64DoubleKeyLRU

func (*U128U64DoubleKeyLRU) Add

func (m *U128U64DoubleKeyLRU) Add(longKey0, longKey1, shortKey uint64, value interface{})

通过longKey进行添加

func (*U128U64DoubleKeyLRU) AddByShortKey

func (m *U128U64DoubleKeyLRU) AddByShortKey(longKey0s, longKey1s []uint64, shortKey uint64, values []interface{})

通过shortKey进行添加

func (*U128U64DoubleKeyLRU) Clear

func (m *U128U64DoubleKeyLRU) Clear()

func (*U128U64DoubleKeyLRU) Get

func (m *U128U64DoubleKeyLRU) Get(longKey0, longKey1 uint64, peek bool) (interface{}, bool)

func (*U128U64DoubleKeyLRU) GetCollisionChain

func (m *U128U64DoubleKeyLRU) GetCollisionChain() []byte

func (*U128U64DoubleKeyLRU) GetCounter

func (m *U128U64DoubleKeyLRU) GetCounter() interface{}

func (*U128U64DoubleKeyLRU) ID

func (m *U128U64DoubleKeyLRU) ID() string

func (*U128U64DoubleKeyLRU) KeySize

func (m *U128U64DoubleKeyLRU) KeySize() int

func (*U128U64DoubleKeyLRU) NoStats

func (*U128U64DoubleKeyLRU) PeekByShortKey

func (m *U128U64DoubleKeyLRU) PeekByShortKey(shortKey uint64) ([]interface{}, bool)

func (*U128U64DoubleKeyLRU) Remove

func (m *U128U64DoubleKeyLRU) Remove(longKey0, longKey1 uint64)

通过longKey进行删除

func (*U128U64DoubleKeyLRU) RemoveByShortKey

func (m *U128U64DoubleKeyLRU) RemoveByShortKey(shortKey uint64) int

通过shortKey进行删除

func (*U128U64DoubleKeyLRU) SetCollisionChainDebugThreshold

func (m *U128U64DoubleKeyLRU) SetCollisionChainDebugThreshold(t int)

func (*U128U64DoubleKeyLRU) Size

func (m *U128U64DoubleKeyLRU) Size() int

func (*U128U64DoubleKeyLRU) Walk

func (m *U128U64DoubleKeyLRU) Walk(callback func(longKey0, longKey1 uint64, value interface{}))

type U64DoubleKeyLRU

type U64DoubleKeyLRU struct {
	utils.Closable
	// contains filtered or unexported fields
}

注意:不是线程安全的

func NewU64DoubleKeyLRU

func NewU64DoubleKeyLRU(module string, hashSlots, relationHashSlots, capacity int, opts ...stats.OptionStatTags) *U64DoubleKeyLRU

func (*U64DoubleKeyLRU) Add

func (m *U64DoubleKeyLRU) Add(key uint64, shortKey uint64, value interface{})

通过longKey进行添加

func (*U64DoubleKeyLRU) AddByShortKey

func (m *U64DoubleKeyLRU) AddByShortKey(keys []uint64, shortKey uint64, values []interface{})

通过shortKey进行添加

func (*U64DoubleKeyLRU) Clear

func (m *U64DoubleKeyLRU) Clear()

func (*U64DoubleKeyLRU) Get

func (m *U64DoubleKeyLRU) Get(key uint64, peek bool) (interface{}, bool)

func (*U64DoubleKeyLRU) GetCollisionChain

func (m *U64DoubleKeyLRU) GetCollisionChain() []byte

func (*U64DoubleKeyLRU) GetCounter

func (m *U64DoubleKeyLRU) GetCounter() interface{}

func (*U64DoubleKeyLRU) ID

func (m *U64DoubleKeyLRU) ID() string

func (*U64DoubleKeyLRU) KeySize

func (m *U64DoubleKeyLRU) KeySize() int

func (*U64DoubleKeyLRU) NoStats

func (m *U64DoubleKeyLRU) NoStats() *U64DoubleKeyLRU

func (*U64DoubleKeyLRU) PeekByShortKey

func (m *U64DoubleKeyLRU) PeekByShortKey(key uint64) ([]interface{}, bool)

func (*U64DoubleKeyLRU) Remove

func (m *U64DoubleKeyLRU) Remove(key uint64)

通过longKey进行删除

func (*U64DoubleKeyLRU) RemoveByShortKey

func (m *U64DoubleKeyLRU) RemoveByShortKey(key uint64) int

通过shortKey进行删除

func (*U64DoubleKeyLRU) SetCollisionChainDebugThreshold

func (m *U64DoubleKeyLRU) SetCollisionChainDebugThreshold(t int)

func (*U64DoubleKeyLRU) Size

func (m *U64DoubleKeyLRU) Size() int

func (*U64DoubleKeyLRU) Walk

func (m *U64DoubleKeyLRU) Walk(callback func(key uint64, value interface{}))

type U64LRU

type U64LRU struct {
	utils.Closable
	// contains filtered or unexported fields
}

注意:不是线程安全的

func NewU64LRU

func NewU64LRU(module string, hashSlots, capacity int, opts ...stats.OptionStatTags) *U64LRU

func NewU64LRUNoStats

func NewU64LRUNoStats(module string, hashSlots, capacity int) *U64LRU

func (*U64LRU) Add

func (m *U64LRU) Add(key uint64, value interface{})

func (*U64LRU) Clear

func (m *U64LRU) Clear()

func (*U64LRU) Close

func (m *U64LRU) Close() error

func (*U64LRU) Get

func (m *U64LRU) Get(key uint64, peek bool) (interface{}, bool)

func (*U64LRU) GetCollisionChain

func (m *U64LRU) GetCollisionChain() []byte

func (*U64LRU) GetCounter

func (m *U64LRU) GetCounter() interface{}

func (*U64LRU) ID

func (m *U64LRU) ID() string

func (*U64LRU) KeySize

func (m *U64LRU) KeySize() int

func (*U64LRU) NoStats

func (m *U64LRU) NoStats() *U64LRU

func (*U64LRU) Remove

func (m *U64LRU) Remove(key uint64)

func (*U64LRU) SetCollisionChainDebugThreshold

func (m *U64LRU) SetCollisionChainDebugThreshold(t int)

func (*U64LRU) Size

func (m *U64LRU) Size() int

func (*U64LRU) Walk

func (m *U64LRU) Walk(callback func(key uint64, value interface{}))

Jump to

Keyboard shortcuts

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