ccache is a software development tool that caches the output of C/C++ compilation so that the next time, the same compilation can be avoided and the results can be taken from the cache. This can greatly speed up recompiling time. The detection is done by hashing different kinds of information that should be unique for the compilation and then using the hash sum to identify the cached output.
To use ccache, you have to install and enable it. You can either enable it system-wide (which might have unforeseen consequences for some) or just for this particular Wesnoth build. For more information on how to do the latter, check CMake or SCons pages, respectively.
It's especially useful for git users, since it greatly enhances build speed after switching git branches.