maps

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2025 License: MIT Imports: 7 Imported by: 0

README

github.com/puzpuzpuz/xsync
github.com/cornelk/hashmap
github.com/alphadose/haxmap

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashMap

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

func NewHashMap

func NewHashMap[K comparable, V any](options ...HashMapOption[K, V]) *HashMap[K, V]

func (*HashMap[K, V]) All added in v1.0.1

func (m *HashMap[K, V]) All() iter.Seq2[K, V]

func (*HashMap[K, V]) Clear added in v1.0.1

func (m *HashMap[K, V]) Clear()

func (*HashMap[K, V]) Delete

func (m *HashMap[K, V]) Delete(k K)

func (*HashMap[K, V]) Get

func (m *HashMap[K, V]) Get(k K) (V, bool)

func (*HashMap[K, V]) Len added in v1.0.1

func (m *HashMap[K, V]) Len() int

func (*HashMap[K, V]) Set

func (m *HashMap[K, V]) Set(k K, v V)

type HashMapOption

type HashMapOption[K comparable, V any] func(*HashMap[K, V])

func WithShardCount

func WithShardCount[K comparable, V any](shardCount int) HashMapOption[K, V]

type Janitor

type Janitor interface {
	SetJanitor(*janitor)
	Janitor() *janitor
	DeleteExpired()
}

type ShardMap

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

func NewShardMap

func NewShardMap[K comparable, V any]() ShardMap[K, V]

func (*ShardMap[K, V]) All added in v1.0.1

func (s *ShardMap[K, V]) All() iter.Seq2[K, V]

func (*ShardMap[K, V]) Clear added in v1.0.1

func (s *ShardMap[K, V]) Clear()

func (*ShardMap[K, V]) Delete

func (s *ShardMap[K, V]) Delete(key K)

func (*ShardMap[K, V]) Get

func (s *ShardMap[K, V]) Get(key K) (value V, ok bool)

func (*ShardMap[K, V]) Len added in v1.0.1

func (s *ShardMap[K, V]) Len() int

func (*ShardMap[K, V]) Set

func (s *ShardMap[K, V]) Set(key K, value V)

type TtlMap

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

func NewTtlMap

func NewTtlMap[K comparable, V any](options ...TtlMapOption[K, V]) *TtlMap[K, V]

func (*TtlMap[K, V]) Delete

func (m *TtlMap[K, V]) Delete(k K)

func (*TtlMap[K, V]) DeleteExpired

func (m *TtlMap[K, V]) DeleteExpired()

func (*TtlMap[K, V]) Get

func (m *TtlMap[K, V]) Get(k K) (V, bool)

func (*TtlMap[K, V]) Janitor

func (m *TtlMap[K, V]) Janitor() *janitor

func (*TtlMap[K, V]) Len added in v1.0.1

func (m *TtlMap[K, V]) Len() int

func (*TtlMap[K, V]) Set

func (m *TtlMap[K, V]) Set(k K, v V)

func (*TtlMap[K, V]) SetJanitor

func (m *TtlMap[K, V]) SetJanitor(j *janitor)

func (*TtlMap[K, V]) SetWithTTL

func (m *TtlMap[K, V]) SetWithTTL(k K, v V, ttl time.Duration)

type TtlMapOption

type TtlMapOption[K comparable, V any] func(*TtlMap[K, V])

func WithCleanupInterval

func WithCleanupInterval[K comparable, V any](interval time.Duration) TtlMapOption[K, V]

func WithNowFn

func WithNowFn[K comparable, V any](nowFn func() time.Time) TtlMapOption[K, V]

func WithTTL

func WithTTL[K comparable, V any](ttl time.Duration) TtlMapOption[K, V]

Jump to

Keyboard shortcuts

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