Documentation
¶
Overview ¶
Package modcache provides a file-based cache for modules.
WARNING: THIS PACKAGE IS EXPERIMENTAL. ITS API MAY CHANGE AT ANY TIME.
Index ¶
- func RemoveAll(dir string) error
- type Cache
- func (c *Cache) Fetch(ctx context.Context, mv module.Version) (module.SourceLoc, error)
- func (c *Cache) FetchFromCache(mv module.Version) (module.SourceLoc, error)
- func (c *Cache) ModuleVersions(ctx context.Context, mpath string) ([]string, error)
- func (c *Cache) Requirements(ctx context.Context, mv module.Version) ([]module.Version, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func New ¶
func New(registry *modregistry.Client, dir string) (*Cache, error)
New returns r wrapped inside a caching layer that stores persistent cached content inside the given OS directory, typically ${CUE_CACHE_DIR}.
The `module.SourceLoc.FS` fields in the locations returned by the registry implement the `OSRootFS` interface, allowing a caller to find the native OS filepath where modules are stored.
The returned type implements [modconfig.Registry] and [modconfig.CachedRegistry].
func (*Cache) Fetch ¶
Fetch returns the location of the contents for the given module version, downloading it if necessary.
func (*Cache) FetchFromCache ¶
FetchFromCache implements cuelang.org/go/mod/modconfig.CachedRegistry.
func (*Cache) ModuleVersions ¶
ModuleVersions implements [modload.Registry.ModuleVersions].