lazycache

package
v0.82.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Useful for creating methods that lazily initialize a derived value and run only once no matter how many times the method is called. Simply add a private field to your struct of type Value[T], and then return the value from a public getter method using Get[T].

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](v *Value[T], initFunc func() T) T

Types

type Value

type Value[T any] struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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