Documentation ¶
Overview ¶
Package cache provides an interface for interfacing with the Glide local cache
Glide has a local cache of metadata and repositories similar to the GOPATH. To store the cache Glide creates a .glide directory with a cache subdirectory. This is usually in the users home directory unless there is no accessible home directory in which case the .glide directory is in the root of the repository.
To get the cache location use the `cache.Location()` function. This will return the proper base location in your environment.
Within the cache directory there are two subdirectories. They are the src and info directories. The src directory contains version control checkouts of the packages. The info direcory contains metadata. The metadata maps to the RepoInfo struct. Both stores are happed to keys.
Using the `cache.Key()` function you can get a key for a repo. Pass in a location such as `https://github.com/foo/bar` or `git@example.com:foo.git` and a key will be returned that can be used for caching operations.
Note, the caching is based on repo rather than package. This is important for a couple reasons.
- Forks or package replacements are supported in Glide. Where a different repo maps to a package.
- Permissions enable different access. For example `https://example.com/foo.git` and `git@example.com:foo.git` may have access to different branches or tags.
Index ¶
- Variables
- func Key(repo string) (string, error)
- func Location() (string, error)
- func Lock(name string)
- func MemCurrent(name string) string
- func MemLatest(name string) string
- func MemPut(name, version string)
- func MemSetCurrent(name, version string)
- func MemTouch(name string)
- func MemTouched(name string) bool
- func SaveRepoData(key string, data RepoInfo) error
- func Setup() error
- func SetupReset()
- func SystemLock() error
- func SystemUnlock()
- func Unlock(name string)
- type RepoInfo
Constants ¶
This section is empty.
Variables ¶
var Enabled = true
Enabled sets if the cache is globally enabled. Defaults to true.
var ErrCacheDisabled = errors.New("Cache disabled")
ErrCacheDisabled is returned with the cache is disabled.
Functions ¶
func MemCurrent ¶
MemCurrent is used to get the current version in use.
func MemLatest ¶
MemLatest returns the latest, that is most recent, semver release. This may be a blank string if no put value
func MemPut ¶
func MemPut(name, version string)
MemPut put a version into the in memory cache for a name. This will silently ignore non-semver and make sure the latest is stored.
func MemSetCurrent ¶
func MemSetCurrent(name, version string)
MemSetCurrent is used to set the current version in use.
func MemTouched ¶
MemTouched returns true if the cache was touched for a name.
func SaveRepoData ¶
SaveRepoData stores data about a repo in the Glide cache
func SetupReset ¶
func SetupReset()
SetupReset resets if setup has been completed. The next time setup is run it will attempt a full setup.
func SystemLock ¶
func SystemLock() error
SystemLock starts a system rather than application lock. This way multiple app instances don't cause race conditions when working in the cache.