SensorContext previousCache / nextCache

I’d like to speed branch analysis by using the previousCache / nextCache methods of SensorContext. The JavaDoc is quite light, so I was wondering if there was more information somewhere else.

Specifically, I’d like to know what cache I can expect when sonar-scanner is executed in a branch. If I’m on the main branch, will I get the cache from the previous analysis (usually previous commit in main) ? Same on feature branches ? First analysis will retrieve the cache of the parent commit in main branch, next analysis in feature branch will get the cache of the first commit in this branch ?

And where is the cache located ? Is that pushed to SonarQube server ? Is stored locally ? In latter case, I assume that the analysis has to be triggered on the same agent.

Thanks !
Gilles

Hey there.

  • For branch analysis, an analysis cache is stored on the server per branch.
  • For pull request analysis, the cache of the base branch is used and not persisted.
  • If no cache is found, the cache of the Main branch is used.

The cache is stored on the SonarQube server.

Thanks ! Is there a limit to the number of “caches” in the main branch ?