@Singleton public class DefaultGlobalCacheManager extends java.lang.Object implements GlobalCacheManager
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
GO_BINARAY_CACHE_PATH |
static java.lang.String |
REPO_CACHE_PATH |
| Constructor and Description |
|---|
DefaultGlobalCacheManager(GolangPluginSetting setting) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
currentRepositoryIsUpToDate()
Check if the repository in current session has been updated recently.
|
void |
endSession()
Terminates current session (in the same thread).
|
void |
ensureGlobalCacheExistAndWritable()
Ensures global cache exists and is writable.
|
java.io.File |
getGlobalCacheRepoDir()
Get the go repository in global cache in current session
|
java.io.File |
getGlobalGoBinCacheDir(java.lang.String relativePath)
Get the path which locates in
relativePath relative to ~/.gradle/go/binary |
java.util.Optional<GlobalCacheMetadata> |
getMetadata(java.nio.file.Path packagePath)
Get the metadata of a package specified by
packagePath |
void |
repoUpdated()
Notifies that the repository in current session has been updated.
|
void |
startSession(VcsGolangPackage pkg)
Starts a session with given package.
|
public static final java.lang.String REPO_CACHE_PATH
public static final java.lang.String GO_BINARAY_CACHE_PATH
@Inject public DefaultGlobalCacheManager(GolangPluginSetting setting)
public void ensureGlobalCacheExistAndWritable()
GlobalCacheManagerensureGlobalCacheExistAndWritable in interface GlobalCacheManagerpublic void startSession(VcsGolangPackage pkg)
GlobalCacheManagerstartSession in interface GlobalCacheManagerpkg - e.g. golang.org/x/toolspublic void endSession()
GlobalCacheManagerendSession in interface GlobalCacheManagerpublic void repoUpdated()
GlobalCacheManagerrepoUpdated in interface GlobalCacheManagerpublic java.io.File getGlobalCacheRepoDir()
GlobalCacheManagergetGlobalCacheRepoDir in interface GlobalCacheManagerpublic java.io.File getGlobalGoBinCacheDir(java.lang.String relativePath)
GlobalCacheManagerrelativePath relative to ~/.gradle/go/binarygetGlobalGoBinCacheDir in interface GlobalCacheManagerrelativePath - the relative path to ~/.gradle/go/binarypublic java.util.Optional<GlobalCacheMetadata> getMetadata(java.nio.file.Path packagePath)
GlobalCacheManagerpackagePathgetMetadata in interface GlobalCacheManagerpackagePath - import path of the packageOptional.empty() otherwise.public boolean currentRepositoryIsUpToDate()
GlobalCacheManagercurrentRepositoryIsUpToDate in interface GlobalCacheManagertrue if the package is up-to-date, false otherwise.GolangPluginSetting.getGlobalCacheSecond()