Help us shape the future of Go! Take the 2026 Go Developer Survey

syncmap

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package syncmap provides a simple generic mutex-guarded map. The zero value is usable; the underlying map is allocated on first Put.

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
}

Map is a lock-paired map keyed by K. Each instance guards a single map with a single mutex — no sharing, no sharding.

func (*Map[K, V]) Get

func (c *Map[K, V]) Get(k K) (V, bool)

Get returns the value for k and whether it was found.

func (*Map[K, V]) Len

func (c *Map[K, V]) Len() int

Len returns the number of entries currently stored.

func (*Map[K, V]) Put

func (c *Map[K, V]) Put(k K, v V)

Put stores v under k, allocating the map on first call.

Jump to

Keyboard shortcuts

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