Documentation
¶
Overview ¶
Package parsecache memoizes parser results so repeated registrations of the same spec share one parsed value and pay the parse cost once.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T any] struct { // Limit softly caps stored entries; <= 0 means unbounded. When full, Get // builds without memoizing. Limit int64 // contains filtered or unexported fields }
Cache is a typed memoizing store. The zero value is ready and unbounded. It is safe for concurrent use.
func (*Cache[T]) Get ¶
Get returns the memoized result for spec, building it with build on first use; concurrent callers for the same spec share one build. Errors are memoized too, so a caller that does not want to pin a failure must Forget it. Once Limit is reached the value is built without being stored.
Click to show internal directories.
Click to hide internal directories.