Cache Config
HTTP cache is off by default, but can speed up requests significantly. The Develocity API disallows HTTP caching, but this library forcefully enables it by overwriting cache-related headers in API responses. Enable with cacheEnabled.
Responses can be:
cached short-term: default max-age of 1 day
/api/builds
cached long-term: default max-age of 1 year
/api/builds/{id}/gradle-attributes
/api/builds/{id}/maven-attributes
/api/builds/{id}/gradle-build-cache-performance
/api/builds/{id}/maven-build-cache-performance
not cached
all other paths
Whether a response is cached short-term, long-term or not cached at all depends on whether it was matched by shortTermCacheUrlPattern or longTermCacheUrlPattern.
Whenever Develocity is upgraded, cache should be cleared.
Caveats
While not encouraged by the API, caching shouldn't have any major downsides other than a time gap for certain queries, or having to reset cache when Develocity is upgraded.
Time gap
/api/builds
responses always change as new builds are uploaded. Caching this path short-term (default 1 day) means new builds uploaded after the cached response won't be included in the query until the cache is invalidated 24h later. If that's a problem, caching can be disabled for this /api/builds
by changing shortTermCacheUrlPattern.
Develocity upgrades
When Develocity is upgraded, any API response can change. New data might be available in API endpoints such as /api/build/{id}/gradle-attributes
. Thus, whenever the Develocity version itself is upgraded, cache should be cleared.
Constructors
Properties
Whether caching is enabled. By default, uses environment variable DEVELOCITY_API_CACHE_ENABLED
or false
.
Max age in seconds for URLs to be cached long-term (matched by longTermCacheUrlPattern). By default, uses environment variable DEVELOCITY_API_LONG_TERM_CACHE_MAX_AGE
or 1 year.
Regex pattern to match API URLs that are OK to store long-term in the HTTP cache, up to longTermCacheMaxAge (1y by default, max value). By default, uses environment variable DEVELOCITY_API_LONG_TERM_CACHE_URL_PATTERN
or a pattern matching:
Max size of the HTTP cache. By default, uses environment variable DEVELOCITY_API_MAX_CACHE_SIZE
or ~1 GB.
Max age in seconds for URLs to be cached short-term (matched by shortTermCacheUrlPattern). By default, uses environment variable DEVELOCITY_API_SHORT_TERM_CACHE_MAX_AGE
or 1 day.
Regex pattern to match API URLs that are OK to store short-term in the HTTP cache, up to shortTermCacheMaxAge (1d by default). By default, uses environment variable DEVELOCITY_API_SHORT_TERM_CACHE_URL_PATTERN
or a pattern matching: