Gradle build cache enables to reuse build artifacts across different build executions: https://docs.gradle.org/current/userguide/build_cache.html
For instance, if linq4j code is not modified, its `compileJava` and `javadoc` results can be reused in the other builds (e.g. PR builds).
test tasks should probably not be cached as the tests often include integrations with databases, so we should execute them from scratch.
Note: the cache is sensitive to Gradle version, Java version, and extra files in the workspace, so the common practice is to seed the cache only from CI jobs.
There's ticket for ASF build cache: https://issues.apache.org/jira/browse/INFRA-20516, however, it is likely we won't be able to use it in GitHub Actions :-/
An alternative option is to setup AWS S3-backed cache via https://github.com/burrunan/gradle-s3-build-cache
Note: the remote build cache can be disabled with -Ps3.build.cache=false