The cache shader can be used to avoid re-evaluating costly parts of the shading network with diamond connections. As that part of the network won't be calculated twice for the same shading point it will speed up renders, especially those with volumes.
To use the cached result, the evaluations must share the same: