Package jenkins.plugins.jobcacher
Class 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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Utility class to calculate the size of a potentially remote directory given a pattern and excludes.static class
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
-
Method Summary
Modifier and TypeMethodDescriptionabstract 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
-
Constructor Details
-
Cache
public Cache()
-
-
Method Details
-
cache
public abstract Cache.Saver cache(ObjectPath cache, ObjectPath defaultCache, Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment, boolean skipRestore) throws IOException, InterruptedExceptionSeeds 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
Gets the human-readable title for this cache to be shown on the user interface.- Returns:
- The title of the cache
-
getJob
Gets the ancestor job when invoked via the stapler context.- Returns:
- the job
-
deriveCachePath
Generates a path within the cache dir given a relative or absolute path that is being cached.- Parameters:
path
- The relative or absolute path that is being cached- Returns:
- A filepath where to save and read from the cache
-