Documentation ¶
Overview ¶
Package filecache is an in-memory file cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an in-memory file cache.
func New ¶ added in v0.3.0
New returns a file cache ready to read directories. The semaphore size is the number of CPUs.
func ReadDir ¶
ReadDir reads a directory recursively and creates a cache of all files that match the expr. Errors if dir or any files under it can't be read.
Files are cached in a hash map and its buffered content can be read using their path without the parent directory included as the key.
func ReadDirContext ¶
ReadDirContext is the context-aware equivalent of ReadDir. If a context gets done before it finishes caching all files, it returns an error.
func (*Cache) Load ¶ added in v0.4.0
Load traverses the set directory recursively to cache files that match a given regexp.
func (*Cache) LoadContext ¶ added in v0.4.0
LoadContext does the same as ReadDir but is context-aware.