@Abbas_Sabra can you elaborate a bit on this one
The recommended way to benefit from the cache, to have higher hit rate, is to copy the master cache.
I’m currently setting up the cache for an iOS app with Objective C code. Without the cache it takes 8-10 min to scan, and with the cache it’s about 40 seconds (there is Swift code as well).
However, the cache seems to only work pr. branch. We have 6 build agents, so I was hoping it would be a shared cache between branches, so once the app has been build on one agent - no matter from what branch, it would work.
But it doesn’t - the cache only seems to work for the specific branch.
E.g if I try this on the same build-node:
cache folder for all branches: /rootfolder/sonarcache/appname
build master -> cache is now full, scan time 10 min
build master again -> cache hit, scan time 40 seconds
build branch -> no cache hit, scan time 10 min
build master -> no cache hit, scan time 10 min
There are no code changes in my example between the branch and master. If I run the branch build twice in a row, I get the same effect as with the master, where the second build has a fast scan due to the cache.
So the cache only works if it’s the same branch building. Is that correct and expected behaviour?
And if a branch cannot find any cache hits based on the master, then I don’t see the point in copying the cache from the master first?
Instead it appears I would need to create a cache folder for each branch, and then only benefit from the cache, the times when a given branch run more than once on any given buildnode. :-/