Discover Packages
github.com/Schaudge/grailbase
sync
once
package
Version:
v0.0.0-...-44c758a
Opens a new window with list of versions in this module.
Published: Feb 23, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package once contains utilities for managing actions that
must be performed exactly once.
Map coordinates actions that must happen exactly once, keyed
by user-defined keys.
Perform the provided action named by a key. Do invokes the action
exactly once for each key, and returns any errors produced by the
provided action.
func (m *Map ) Forget(key interface{})
Forget forgets past computations associated with the provided key.
Task manages a computation that must be run at most once.
It's similar to sync.Once, except it also handles and returns errors.
Do run the function do at most once. Successive invocations of Do
guarantee exactly one invocation of the function do. Do returns
the error of do's invocation.
Done returns whether the task is done.
Reset resets the task effectively making it possible for `Do` to invoke the underlying do func again.
Reset will only reset the task if it was already completed.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.