DirectoryBuildCache (Gradle API 4.7)
Date: 2018-04-18

org.gradle.caching.local

## Class DirectoryBuildCache

- java.lang.Object
- - org.gradle.caching.configuration.AbstractBuildCache
  - - org.gradle.caching.local.DirectoryBuildCache

- All Implemented Interfaces:
    BuildCache

      public class DirectoryBuildCache
      extends AbstractBuildCache

  Configuration object for the local directory build cache.
  Since:
    3.5

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirectoryBuildCache()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getDirectory()` Returns the directory to use to store the build cache.
    `int` | `getRemoveUnusedEntriesAfterDays()` Returns the number of days after unused entries are garbage collected.
    `long` | `getTargetSizeInMB()` Deprecated. Use `getRemoveUnusedEntriesAfterDays()` instead.
    `void` | `setDirectory(Object directory)` Sets the directory to use to store the build cache.
    `void` | `setRemoveUnusedEntriesAfterDays(int removeUnusedEntriesAfterDays)` Sets the number of days after unused entries are garbage collected.
    `void` | `setTargetSizeInMB(long targetSizeInMB)` Deprecated. Use `setRemoveUnusedEntriesAfterDays(int)` instead.

    - ### Methods inherited from class org.gradle.caching.configuration.AbstractBuildCache

      `isEnabled, isPush, setEnabled, setPush`

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

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

- - ### Constructor Detail

    - #### DirectoryBuildCache

          public DirectoryBuildCache()

  - ### Method Detail

    - #### getDirectory

          @Nullable
          public Object getDirectory()

      Returns the directory to use to store the build cache.

    - #### setDirectory

          public void setDirectory(Object directory)

      Sets the directory to use to store the build cache. The directory is evaluated as per `Project.file(Object)`.

    - #### getTargetSizeInMB

          @Deprecated
          public long getTargetSizeInMB()

      Deprecated. Use `getRemoveUnusedEntriesAfterDays()` instead.
      Used to be the target size of the build cache in megabytes, now returns `0`.

    - #### setTargetSizeInMB

          @Deprecated
          public void setTargetSizeInMB(long targetSizeInMB)

      Deprecated. Use `setRemoveUnusedEntriesAfterDays(int)` instead.
      Used to set the target size of the build cache in megabytes, now has no effect.

    - #### getRemoveUnusedEntriesAfterDays

          @Incubating
          public int getRemoveUnusedEntriesAfterDays()

      Returns the number of days after unused entries are garbage collected. Defaults to 7 days.
      Since:
        4.6

    - #### setRemoveUnusedEntriesAfterDays

          @Incubating
          public void setRemoveUnusedEntriesAfterDays(int removeUnusedEntriesAfterDays)

      Sets the number of days after unused entries are garbage collected. Defaults to 7 days. Must be greater than 1.
      Since:
        4.6