Package org.eclipse.jgit.storage.file

## Class WindowCacheConfig

- java.lang.Object
- - org.eclipse.jgit.storage.file.WindowCacheConfig

    public class WindowCacheConfig
    extends Object

Configuration parameters for JVM-wide buffer cache used by JGit.

### Field Summary

Fields
`static int` `KB` 1024 (number of bytes in one kibibyte/kilobyte)
`static int` `MB` 1024 `KB` (number of bytes in one mebibyte/megabyte)

### Constructor Summary

Constructors
`WindowCacheConfig()` Create a default configuration.

### Method Summary

All Methods Instance Methods Concrete Methods
`WindowCacheConfig` `fromConfig​(Config rc)` Update properties by setting fields from the configuration.
`int` `getDeltaBaseCacheLimit()`
`long` `getPackedGitLimit()`
`int` `getPackedGitOpenFiles()`
`int` `getPackedGitWindowSize()`
`int` `getStreamFileThreshold()`
`void` `install()` Install this configuration as the live settings.
`boolean` `isPackedGitMMAP()`
`void` `setDeltaBaseCacheLimit​(int newLimit)`
`void` `setPackedGitLimit​(long newLimit)`
`void` `setPackedGitMMAP​(boolean usemmap)`
`void` `setPackedGitOpenFiles​(int fdLimit)`
`void` `setPackedGitWindowSize​(int newSize)`
`void` `setStreamFileThreshold​(int newLimit)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### KB

    public static final int KB

1024 (number of bytes in one kibibyte/kilobyte)

See Also:
  Constant Field Values

#### MB

    public static final int MB

1024 `KB` (number of bytes in one mebibyte/megabyte)

See Also:
  Constant Field Values

### Constructor Detail

#### WindowCacheConfig

    public WindowCacheConfig()

Create a default configuration.

### Method Detail

#### getPackedGitOpenFiles

    public int getPackedGitOpenFiles()

Returns:
  maximum number of streams to open at a time. Open packs count against the process limits. Default is 128.

#### setPackedGitOpenFiles

    public void setPackedGitOpenFiles​(int fdLimit)

Parameters:
  `fdLimit` - maximum number of streams to open at a time. Open packs count against the process limits

#### getPackedGitLimit

    public long getPackedGitLimit()

Returns:
  maximum number bytes of heap memory to dedicate to caching pack file data. Default is 10 MB.

#### setPackedGitLimit

    public void setPackedGitLimit​(long newLimit)

Parameters:
  `newLimit` - maximum number bytes of heap memory to dedicate to caching pack file data.

#### getPackedGitWindowSize

    public int getPackedGitWindowSize()

Returns:
  size in bytes of a single window mapped or read in from the pack file. Default is 8 KB.

#### setPackedGitWindowSize

    public void setPackedGitWindowSize​(int newSize)

Parameters:
  `newSize` - size in bytes of a single window read in from the pack file.

#### isPackedGitMMAP

    public boolean isPackedGitMMAP()

Returns:
  true enables use of Java NIO virtual memory mapping for windows; false reads entire window into a byte[] with standard read calls. Default false.

#### setPackedGitMMAP

    public void setPackedGitMMAP​(boolean usemmap)

Parameters:
  `usemmap` - true enables use of Java NIO virtual memory mapping for windows; false reads entire window into a byte[] with standard read calls.

#### getDeltaBaseCacheLimit

    public int getDeltaBaseCacheLimit()

Returns:
  maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains. Default 10 MB.

#### setDeltaBaseCacheLimit

    public void setDeltaBaseCacheLimit​(int newLimit)

Parameters:
  `newLimit` - maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains.

#### getStreamFileThreshold

    public int getStreamFileThreshold()

Returns:
  the size threshold beyond which objects must be streamed.

#### setStreamFileThreshold

    public void setStreamFileThreshold​(int newLimit)

Parameters:
  `newLimit` - new byte limit for objects that must be streamed. Objects smaller than this size can be obtained as a contiguous byte array, while objects bigger than this size require using an `ObjectStream`.

#### fromConfig

    public WindowCacheConfig fromConfig​(Config rc)

Update properties by setting fields from the configuration.

If a property is not defined in the configuration, then it is left unmodified.

Parameters:
  `rc` - configuration to read properties from.
Returns:
  `this`.
Since:
  3.0

#### install

    public void install()

Install this configuration as the live settings.

The new configuration is applied immediately. If the new limits are smaller than what what is currently cached, older entries will be purged as soon as possible to allow the cache to meet the new limit.

Since:
  3.0