Package org.eclipse.jgit.lib
Class RepositoryCacheConfig
java.lang.Object
org.eclipse.jgit.lib.RepositoryCacheConfig
Configuration parameters for JVM-wide repository cache used by JGit.
- Since:
- 4.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
Set cleanupDelayMillis to this value in order to auto-set it to minimum of 1/10 of expireAfterMillis and 10 minutesprivate long
private long
static final long
Set cleanupDelayMillis to this value in order to switch off time-based cache eviction. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromConfig
(Config config) Update properties by setting fields from the configuration.long
Get the delay between the periodic cleanup of expired repository in milliseconds.long
Get the time an unused repository should be expired and be evicted from the RepositoryCache in milliseconds.void
install()
Install this configuration as the live settings.void
setCleanupDelay
(long cleanupDelayMillis) Set the delay between the periodic cleanup of expired repository in milliseconds.void
setExpireAfter
(long expireAfterMillis) Set the time an unused repository should be expired and be evicted from the RepositoryCache in milliseconds.
-
Field Details
-
NO_CLEANUP
public static final long NO_CLEANUPSet cleanupDelayMillis to this value in order to switch off time-based cache eviction. Expired cache entries will only be evicted when RepositoryCache.clearExpired or RepositoryCache.clear are called.- See Also:
-
AUTO_CLEANUP_DELAY
public static final long AUTO_CLEANUP_DELAYSet cleanupDelayMillis to this value in order to auto-set it to minimum of 1/10 of expireAfterMillis and 10 minutes- See Also:
-
expireAfterMillis
private long expireAfterMillis -
cleanupDelayMillis
private long cleanupDelayMillis
-
-
Constructor Details
-
RepositoryCacheConfig
public RepositoryCacheConfig()Create a default configuration.
-
-
Method Details
-
getExpireAfter
public long getExpireAfter()Get the time an unused repository should be expired and be evicted from the RepositoryCache in milliseconds.- Returns:
- the time an unused repository should be expired and be evicted from the RepositoryCache in milliseconds. Default is 1 hour.
-
setExpireAfter
public void setExpireAfter(long expireAfterMillis) Set the time an unused repository should be expired and be evicted from the RepositoryCache in milliseconds.- Parameters:
expireAfterMillis
- the time an unused repository should be expired and be evicted from the RepositoryCache in milliseconds.
-
getCleanupDelay
public long getCleanupDelay()Get the delay between the periodic cleanup of expired repository in milliseconds.- Returns:
- the delay between the periodic cleanup of expired repository in milliseconds. Default is minimum of 1/10 of expireAfterMillis and 10 minutes
-
setCleanupDelay
public void setCleanupDelay(long cleanupDelayMillis) Set the delay between the periodic cleanup of expired repository in milliseconds.- Parameters:
cleanupDelayMillis
- the delay between the periodic cleanup of expired repository in milliseconds. Set it toAUTO_CLEANUP_DELAY
to automatically derive cleanup delay from expireAfterMillis.Set it to
NO_CLEANUP
in order to switch off cache expiration.If cache expiration is switched off the JVM still can evict cache entries when the JVM is running low on available heap memory.
-
fromConfig
Update properties by setting fields from the configuration.If a property is not defined in the configuration, then it is left unmodified.
- Parameters:
config
- configuration to read properties from.- Returns:
this
.
-
install
public void install()Install this configuration as the live settings.The new configuration is applied immediately.
-