[ccache] cache coherency across multiple users

Joel Rosdahl joel at rosdahl.net
Sun Apr 3 05:01:47 MDT 2011

On 2011-04-02 06:26, wangbin wrote:
> What's the method to replace/throw away old .o/.d/.manifest file in cache?

As Wilson Snyder said: using atomic file system rename() calls. The new
file content is written to a temporary file and then the temporary file
is renamed to the file that should be replaced.

Or do you want to know how ccache can know which files to throw away to
decrease the cache size? It does this by updating mtime of files that
are read on each cache hit. A counter of the current cache size is also
updated when new files are written to the cache, and when the cache size
exceeds the configured limit, files with the oldest mtimes are deleted.

> What factors will effected this operation, source code context, path...etc? 

I'm not sure I understand the question. What do you mean? The cache
cleanup algorithm only takes cache size into account (or number of files
in the cache, if you have set a limit on the number of files).

-- Joel

More information about the ccache mailing list