[ccache] Combining caches

Joel Rosdahl joel at rosdahl.net
Wed May 5 11:34:18 MDT 2010

On 2010-05-05 00:08, Mike McLean wrote:
> I know it is possible to use a shared cache, but is it possible to
> take two separate caches and combine them into one?

I don't see any major problems, but here are some things to consider:

The destination cache shouldn't be used while copying files into it.

To get the statistics counters correct, you would also have to merge the
counters in $CCACHE_DIR/{*/,}stats. That should be easy since they are
just text files containing space-separated integers. (Two of the values
are actually the cache size configuration settings, which probably
shouldn't be summed.)

The manifest files introduced in ccache 3.0 are harder to merge. It's
certainly possible to write some code to do it, though. If a manifest
file with the same name exists in both of the merged caches, nothing
will break if you just select one of them, but some cached results are
of course lost (more specifically: direct mode entries for compilations
where header files have changed but not the source code file or compiler

> Would there be any issues if different versions of ccache are in use?

Not that I can think of.

-- Joel

More information about the ccache mailing list