MCPcopy Index your code
hub / github.com/coder/coder / Load

Method Load

coderd/util/lazy/value.go:17–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15}
16
17func (v *Value[T]) Load() T {
18 v.once.Do(func() {
19 vv := v.fn()
20 v.cached.Store(&vv)
21 })
22 return *v.cached.Load()
23}
24
25// New creates a new lazy value with the given load function.
26func New[T any](fn func() T) *Value[T] {

Callers 3

TestLazyWithErrorOKFunction · 0.45
TestLazyWithErrorErrFunction · 0.45

Calls 2

DoMethod · 0.65
StoreMethod · 0.45

Tested by 3

TestLazyWithErrorOKFunction · 0.36
TestLazyWithErrorErrFunction · 0.36