tls

package
v2.8.4 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package tls provides goroutine-local storage (thread-local storage). Values are keyed by their type and scoped to the current goroutine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear[V any]()

Clear removes the value of the given type from the current goroutine's local storage. If no values remain for the goroutine, the entire store entry is cleaned up.

func Get

func Get[V any]() (V, bool)

Get retrieves a value from the current goroutine's local storage by type. Returns the value and true if found, or the zero value and false otherwise.

func Put

func Put[V any](value V)

Put stores a value in the current goroutine's local storage, keyed by its type. Calling Put multiple times with the same type overwrites the previous value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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