xzmap

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K comparable, T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](opts ...Option[string, T]) *Map[string, T]

func NewStringer

func NewStringer[K MapStringer, T any](opts ...Option[K, T]) *Map[K, T]

func (*Map[K, T]) Clean

func (m *Map[K, T]) Clean()

非同步 缓存Map清理

func (*Map[K, T]) Get

func (m *Map[K, T]) Get(key K) (item mapitem.Item[T], ok bool)

获取值

func (*Map[K, T]) Has

func (m *Map[K, T]) Has(key K) bool

判断是否有值

func (*Map[K, T]) Items added in v1.0.2

func (m *Map[K, T]) Items() map[K]mapitem.Item[T]

获取所有Item

func (*Map[K, T]) IterBuffered

func (m *Map[K, T]) IterBuffered() <-chan tuple[K, mapitem.Item[T]]

多线程读取所有数据

func (*Map[K, T]) Remove

func (m *Map[K, T]) Remove(key K)

删除值

func (*Map[K, T]) Set

func (m *Map[K, T]) Set(key K, value T, opts ...mapitem.Option[T])

设置值

func (*Map[K, T]) Size added in v1.0.2

func (m *Map[K, T]) Size() int

type MapStringer added in v1.0.2

type MapStringer interface {
	comparable
	fmt.Stringer
}

type Option

type Option[K comparable, T any] func(m *Map[K, T])

func WithItemOpts added in v1.0.2

func WithItemOpts[K comparable, T any](opts ...mapitem.Option[T]) Option[K, T]

配置默认缓存策略

func WithSharedSize

func WithSharedSize[K comparable, T any](size int) Option[K, T]

设置分片大小

Jump to

Keyboard shortcuts

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