Package jenkins.plugins.jobcacher
Class Cache
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<Cache>
-
- jenkins.plugins.jobcacher.Cache
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<Cache>
,Serializable
- Direct Known Subclasses:
ArbitraryFileCache
public abstract class Cache extends AbstractDescribableImpl<Cache> implements ExtensionPoint, Serializable
This class provides the Cache extension point that when implemented provides the caching logic for saving files from the executor to the cache storage system and sending them back to the executor.Note, that Cache is Serializable and all subclasses must conform as well to work with Pipeline plugin
- Author:
- Peter Hayes
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Cache.DirectorySize
Utility class to calculate the size of a potentially remote directory given a pattern and excludes.static class
Cache.Saver
Class that is used to save the cache on the remote system back to the cache storage system.-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description Cache()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Cache.Saver
cache(ObjectPath cache, ObjectPath defaultCache, Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment, boolean skipRestore)
Seeds the cache on the executor from the cache storage system.static String
deriveCachePath(String path)
Generates a path within the cache dir given a relative or absolute path that is being cached.Job<?,?>
getJob()
Gets the ancestor job when invoked via the stapler context.abstract String
getTitle()
Gets the human-readable title for this cache to be shown on the user interface.-
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
-
-
-
Method Detail
-
cache
public abstract Cache.Saver cache(ObjectPath cache, ObjectPath defaultCache, Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment, boolean skipRestore) throws IOException, InterruptedException
Seeds the cache on the executor from the cache storage system.- Parameters:
cache
- The root of the object cachedefaultCache
- The root of the alternate default object cachebuild
- The build in progressworkspace
- The executor workspacelauncher
- The launcherlistener
- The task listenerinitialEnvironment
- The initial environment variablesskipRestore
- Whether to skip restoring the cache- Throws:
IOException
- If an error occurs connecting to the potentially remote executorInterruptedException
- If interrupted
-
getTitle
public abstract String getTitle()
Gets the human-readable title for this cache to be shown on the user interface.- Returns:
- The title of the cache
-
getJob
public Job<?,?> getJob()
Gets the ancestor job when invoked via the stapler context.- Returns:
- the job
-
-