Class GitHubClientCacheOps
java.lang.Object
org.jenkinsci.plugins.github.internal.GitHubClientCacheOps
Class with util functions to operate GitHub client cache
- Since:
- 1.14.0
- Author:
- lanwen (Merkushev Kirill)
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.base.Function
<okhttp3.Cache, String> Extracts relative to base cache dir name of cache folder for each config For example if the full path to cache folder is "$JENKINS_HOME/org.jenkinsci.plugins.github.GitHubPlugin.cache/keirurna", this function returns "keirurna"static void
clearRedundantCaches
(List<GitHubServerConfig> configs) Removes all not active dirs with old caches.static Path
This directory contains all other cache dirs for each client configstatic DirectoryStream.Filter
<Path> notInCaches
(Set<String> caches) To accept for cleaning only not active cache dirsstatic com.google.common.base.Function
<GitHubServerConfig, okhttp3.Cache> static com.google.common.base.Predicate
<GitHubServerConfig>
-
Method Details
-
withEnabledCache
- Returns:
- predicate which returns true if cache enabled for applied
GitHubServerConfig
-
toCacheDir
- Returns:
- function to convert
GitHubServerConfig
toCache
-
cacheToName
Extracts relative to base cache dir name of cache folder for each config For example if the full path to cache folder is "$JENKINS_HOME/org.jenkinsci.plugins.github.GitHubPlugin.cache/keirurna", this function returns "keirurna"- Returns:
- function to extract folder name from cache object
-
notInCaches
To accept for cleaning only not active cache dirs- Parameters:
caches
- set of active cache names, extracted with help ofcacheToName()
- Returns:
- filter to accept only names not in set
-
getBaseCacheDir
This directory contains all other cache dirs for each client config- Returns:
- path to base cache directory.
-
clearRedundantCaches
Removes all not active dirs with old caches. This method is invoked after each save of global plugin config- Parameters:
configs
- active server configs to exclude caches from cleanup
-