limiter

package
v0.0.0-...-6e19431 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveValueRef

type ActiveValueRef struct {
	// contains filtered or unexported fields
}

func (ActiveValueRef) C

func (me ActiveValueRef) C() chan struct{}

Returns the limiting channel. Send to it to obtain a slot, and receive to release the slot.

func (ActiveValueRef) Drop

func (me ActiveValueRef) Drop()

Drop the reference to a key, this allows keys to be reclaimed when they're no longer in use.

type Instance

type Instance struct {
	SlotsPerKey int
	// contains filtered or unexported fields
}

Manages resources with a limited number of concurrent slots for use for each key.

func (*Instance) GetRef

func (i *Instance) GetRef(key Key) ActiveValueRef

Get a reference to the values for a key. You should make sure to call Drop exactly once on the returned value when done.

type Key

type Key = interface{}

Jump to

Keyboard shortcuts

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