Class RepositoryCacheConfig


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

      Fields 
      Modifier and Type Field Description
      static 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
      private long cleanupDelayMillis  
      private long expireAfterMillis  
      static long NO_CLEANUP
      Set cleanupDelayMillis to this value in order to switch off time-based cache eviction.
    • Constructor Summary

      Constructors 
      Constructor Description
      RepositoryCacheConfig()
      Create a default configuration.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      RepositoryCacheConfig fromConfig​(Config config)
      Update properties by setting fields from the configuration.
      long getCleanupDelay()
      Get the delay between the periodic cleanup of expired repository in milliseconds.
      long getExpireAfter()
      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.
      • Methods inherited from class java.lang.Object

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

      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • expireAfterMillis

        private long expireAfterMillis
      • cleanupDelayMillis

        private long cleanupDelayMillis
    • Constructor Detail

      • RepositoryCacheConfig

        public RepositoryCacheConfig()
        Create a default configuration.
    • Method Detail

      • 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.