package modcache
import "cuelang.org/go/mod/modcache"
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 New(registry *modregistry.Client, dir string) (*Cache, error)
- 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)
Functions ¶
func RemoveAll ¶
RemoveAll removes a directory written by the cache, first applying any permission changes needed to do so.
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].
func (*Cache) Requirements ¶
Source Files ¶
cache.go fetch.go
- Version
- v0.13.0-alpha.3
- Published
- Mar 31, 2025
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 4 minutes ago –
Tools for package owners.