(we use nodejs environment)
Imagine:
Somebody develop the project in main branch. He updated several dependencies. After successful building on CI pipelines-cache will get new package. everything is ok
Checkout to other branch without this changes of packages. Cache downloaded completely. BUT you need to reinstall dependencies in CI. and after that cache will be saved.
Checkout to main branch and cache you need to reinstall one more time.
If team have 10+ developers the problem is formulated as "cache doesn't work"
Expect behavior - cache is really specific for every git branch