gomap

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 2 Imported by: 0

README

gomap

a blazingly fast thread-safe map for go with sharding

Documentation

Overview

Package gomap provides optimized, sharded hash maps which are thread-safe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

func New

func New[K comparable, V any](shards uint64, preallocPerShard uint64) *Map[K, V]

New creates a new Map. Shards defines the amount of shards to use, while preallocPerShard defines how many elements per Shard should be preallocated in memory. Use 0 to use default values.

func (*Map[K, V]) Delete

func (m *Map[K, V]) Delete(key K)

func (*Map[K, V]) Get

func (m *Map[K, V]) Get(key K) V

func (*Map[K, V]) Has

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

func (*Map[K, V]) Set

func (m *Map[K, V]) Set(key K, value V)

type Shard

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

func (*Shard[K, V]) Delete

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

func (*Shard[K, V]) Get

func (s *Shard[K, V]) Get(key K) V

func (*Shard[K, V]) Has

func (s *Shard[K, V]) Has(key K) bool

func (*Shard[K, V]) Set

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

Jump to

Keyboard shortcuts

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