sync

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: MIT Imports: 1 Imported by: 0

README

gosync

gosync is a synchronization package complimentary to Go's standard sync package.

Installation

go get -u github.com/zhongruoyu/gosync@latest

Usage

The types in gosync provides an additional typed interface on top of Go's standard sync package. They should work just as they do in the standard library. For more information, see the documentation.

License

Copyright (c) 2022 Zhong Ruoyu. Licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

func (*Map[K, V]) Delete

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

func (*Map[K, V]) Load

func (m *Map[K, V]) Load(key K) (value V, ok bool)

func (*Map[K, V]) LoadAndDelete

func (m *Map[K, V]) LoadAndDelete(key K) (value V, loaded bool)

func (*Map[K, V]) LoadOrStore

func (m *Map[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)

func (*Map[K, V]) Range

func (m *Map[K, V]) Range(f func(key K, value V) bool)

func (*Map[K, V]) Store

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

type Pool

type Pool[E any] struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool[E any](new func() E) *Pool[E]

func (*Pool[E]) Get

func (pool *Pool[E]) Get() E

func (*Pool[E]) Put

func (pool *Pool[E]) Put(x E)

func (*Pool[E]) Update

func (pool *Pool[E]) Update(new func() E)

Jump to

Keyboard shortcuts

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