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:
  • 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, InterruptedException
      Seeds the cache on the executor from the cache storage system.
      Parameters:
      cache - The root of the object cache
      defaultCache - The root of the alternate default object cache
      build - The build in progress
      workspace - The executor workspace
      launcher - The launcher
      listener - The task listener
      initialEnvironment - The initial environment variables
      skipRestore - Whether to skip restoring the cache
      Throws:
      IOException - If an error occurs connecting to the potentially remote executor
      InterruptedException - 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
    • deriveCachePath

      public static String deriveCachePath(String path)
      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