Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache persists the files for template versions, and is used by dynamic parameters to deduplicate the files in memory. When any number of users opens the workspace creation form for a given template version, it's files are loaded into memory exactly once. We hold those files until there are no longer any open connections, and then we remove the value from the map.
func NewFromStore ¶
NewFromStore returns a file cache that will fetch files from the provided database.
func (*Cache) Acquire ¶
Acquire will load the fs.FS for the given file. It guarantees that parallel calls for the same fileID will only result in one fetch, and that parallel calls for distinct fileIDs will fetch in parallel.
Every call to Acquire must have a matching call to Release.