Class RepositoryCacheConfig

java.lang.Object
org.eclipse.jgit.lib.RepositoryCacheConfig

public class RepositoryCacheConfig extends Object
Configuration parameters for JVM-wide repository cache used by JGit.
Since:
4.4
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Set cleanupDelayMillis to this value in order to auto-set it to minimum of 1/10 of expireAfterMillis and 10 minutes
    private long
     
    private long
     
    static final long
    Set cleanupDelayMillis to this value in order to switch off time-based cache eviction.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a default configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    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 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NO_CLEANUP

      public static final long NO_CLEANUP
      Set 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_DELAY
      Set 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 to AUTO_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

      public RepositoryCacheConfig fromConfig(Config config)
      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.