Interface BuildCacheManager
-
- All Known Implementing Classes:
BuildCacheManagerImpl
public interface BuildCacheManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddCachePathForPublishingToRegisteredCache(String cacheName, String cachePath)Adds a single cache path to be published in a specific build cache.voidaddCachePathForPublishingToRegisteredCache(String cacheName, String cachePath, Collection<String> exclusionRules, Collection<String> inclusionRules)Adds a single cache path to be published in a specific build cache considering the rules for excluding/including specific directories or files under this cache path.voidaddCachePathsForPublishing(String cacheName, boolean isPublishOnlyChanged, boolean isCalculateFilesChecksum, List<String> cachePaths)Registers the cache for publishing (overridingisPublishOnlyChangedandisCalculateFilesChecksumif it has been registered already) and adds cache path for publishing to it.voidaddCachePathsForPublishingToRegisteredCache(String cacheName, List<String> cachePaths)Adds cache paths to be published in a specific build cache.booleanisCacheRegisteredForPublishing(String cacheName)Checks if a cache was registered for publishing viaregisterCacheForPublishing(String, boolean, boolean).voidregisterCacheForPublishing(String cacheName, boolean isPublishOnlyChanged, boolean isCalculateFilesChecksum)Registers the specific cache name for publishing at the end of the build.booleanrestoreCache(String cacheName)Restores the contents (cached paths) and the metadata of a cache for the specifiedcacheName.booleanrestoreCacheMetadataOnly(String cacheName)Restores the metadata of a cache without restoring the cache contents for the specifiedcacheName.
-
-
-
Method Detail
-
restoreCache
boolean restoreCache(@NotNull String cacheName)Restores the contents (cached paths) and the metadata of a cache for the specifiedcacheName.- Parameters:
cacheName- the name of the cache to restore- Returns:
trueif the cache was restored successfully
-
restoreCacheMetadataOnly
boolean restoreCacheMetadataOnly(@NotNull String cacheName)Restores the metadata of a cache without restoring the cache contents for the specifiedcacheName. This method should be called when only the metadata of the cache is needed, for example, for cache contents comparison when the cache will be published viaregisterCacheForPublishing(String, boolean, boolean)withisPublishOnlyChangedset totrue.- Parameters:
cacheName- the name of the cache to restore the metadata for- Returns:
trueif the cache metadata was restored successfully
-
registerCacheForPublishing
void registerCacheForPublishing(@NotNull String cacheName, boolean isPublishOnlyChanged, boolean isCalculateFilesChecksum)Registers the specific cache name for publishing at the end of the build. The actual publishing happens after all build steps of the build have finished. IfisPublishOnlyChangedis set totrue, the metadata of the current cache should be restored in advance by callingrestoreCache(String)orrestoreCacheMetadataOnly(String)(othewise it is impossible to detect changes).- Parameters:
cacheName- the name of the cache to publishisPublishOnlyChanged- when set totruethe cache will be published only if its contents changed; cache metadata should be available in this caseisCalculateFilesChecksum- indicates whether to calculate the checksum of cache contents
-
isCacheRegisteredForPublishing
boolean isCacheRegisteredForPublishing(@NotNull String cacheName)Checks if a cache was registered for publishing viaregisterCacheForPublishing(String, boolean, boolean).- Parameters:
cacheName- the name of the cache- Returns:
trueif the cache is registered for publishing
-
addCachePathsForPublishingToRegisteredCache
void addCachePathsForPublishingToRegisteredCache(@NotNull String cacheName, @NotNull List<String> cachePaths)Adds cache paths to be published in a specific build cache. The build cache with this name should be registered for publishing viaregisterCacheForPublishing(String, boolean, boolean)before calling this method.- Parameters:
cacheName- the name of the build cachecachePaths- the list of paths to include in the cache
-
addCachePathForPublishingToRegisteredCache
void addCachePathForPublishingToRegisteredCache(@NotNull String cacheName, @NotNull String cachePath)Adds a single cache path to be published in a specific build cache. The build cache with this name should be registered for publishing viaregisterCacheForPublishing(String, boolean, boolean)before calling this method.- Parameters:
cacheName- the name of the build cachecachePath- the path to include in the cache
-
addCachePathForPublishingToRegisteredCache
void addCachePathForPublishingToRegisteredCache(@NotNull String cacheName, @NotNull String cachePath, @NotNull Collection<String> exclusionRules, @NotNull Collection<String> inclusionRules)Adds a single cache path to be published in a specific build cache considering the rules for excluding/including specific directories or files under this cache path. The build cache with this name should be registered for publishing viaregisterCacheForPublishing(String, boolean, boolean)before calling this method.- Parameters:
cacheName- the name of the build cachecachePath- the path to include in the cacheexclusionRules- the list of exclusion rulesinclusionRules- the list of inclusion rules
-
addCachePathsForPublishing
void addCachePathsForPublishing(@NotNull String cacheName, boolean isPublishOnlyChanged, boolean isCalculateFilesChecksum, @NotNull List<String> cachePaths)Registers the cache for publishing (overridingisPublishOnlyChangedandisCalculateFilesChecksumif it has been registered already) and adds cache path for publishing to it. Basically, works asregisterCacheForPublishing(String, boolean, boolean)andaddCachePathsForPublishingToRegisteredCache(String, List)combined.- Parameters:
cacheName- the name of the cache to publishisPublishOnlyChanged- when set totruethe cache will be published only if its contents changed; cache metadata should be available in this caseisCalculateFilesChecksum- indicates whether to calculate the checksum of cache contentscachePaths- the list of paths to include in the cache
-
-