Infrastructure worth keeping — and kept patched.

Can several projects share one build cache server?

Yes, several projects can use one FosterStack Cache server. In our runs they shared the results of identical work and could read each other's results. If a group must not see another group's results, give that group its own server.

The short answer

What to do

Our advice, not a test result:

Gradle and Maven builds can use the same server too. See one build cache server for Gradle and Maven.

How we checked

FosterStack Cache 0.2.1 and Gradle 9.8.0 with Java 21 on a Mac (arm64), one machine. Project A has three classes, project B has four different ones, and project C is an exact copy of A in a different folder. Each build ran compileJava and jar with a new Gradle home, Gradle's --no-daemon flag and the local build cache off. The cache address and login reached the build only as environment variables. All logins were made up for the test. Each row is one run.

One server, no size cap. The same read-write login for all three builds.

BuildCompile taskEntries on the server afterwardsRestored from the server
ARan2Nothing
B, different codeRan31: the compiled build script
C, a copy of A in another folderFROM-CACHE32: A's compile result and the build script

The jar task ran in every build, so it is left out of the rows. The key of A's compile result was the same in the copy as in A, so folder names do not matter here.

Direct requests to the same server. The key is the request path. The docs say the whole request path is the key, and we found no project or namespace setting in them.

RequestAnswer
A's compile key, with the read-write login200, 1,659 bytes
B's compile key, with the same login200, 1,803 bytes
Both keys, with the read-only login200 each
A write with the read-only login403, entries stayed at 3
A's key with no login, or a wrong password401
A project name in front of the key404 for both keys
Builds of A and B with the read-only login and pushing offEach restored its compile result

Two servers, one for each team. Each has its own data folder and logins.

BuildWhat happened
A on team 1's serverRan and stored 2 entries
C on team 1's serverCompile result restored
C on team 2's server, sending team 1's login401, the build warned, switched the remote cache off for the rest of that build, and ran everything
C on team 2's server, with team 2's loginRestored nothing and stored 2 entries
The same build again on team 2's serverCompile result restored

Each team's login got a 401 on the other team's server when we asked for A's key directly.

One small size cap. A server with a 5,000-byte cap, where A's two entries take 4,472 bytes.

BuildCompile taskEvicted so farEntries afterwards
ARan0A's compile result, the build script
BRan1B's compile result, the build script
C, a copy of ARan2A's compile result, the build script
B againRan3B's compile result, the build script

The cap belongs to the server, not to a project. The compile entry of the project that built last stayed. So did the shared build-script entry. This cap is far smaller than a real one. We only checked that the cap is shared.

Limits: Gradle only, three small projects, one run of each case on each machine. We did not test Maven, many projects building at once, or real project sizes.

Second run: Linux, 0.2.2

The run above was on a Mac with 0.2.1. We ran it again on a GitHub-hosted Linux machine with FosterStack Cache 0.2.2, Gradle 9.8.0 and Java 21, with three small projects of our own written in the same shape.

The run and its log are public.