string_limiter

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 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 keyed by a string.

func (*Instance) GetRef

func (i *Instance) GetRef(key string) 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.

Jump to

Keyboard shortcuts

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