I've been noticing this for a while that ccache doesn't actually get local hits when I'm using distcc. I think I broke this with
IMPALA-4701. It seems like the proper way to do wrapper scripts with ccache is to use CCACHE_PREFIX https://ccache.dev/manual/3.4.html#_using_ccache_with_other_compiler_wrappers.
Anyway I played around with this and got it to work nicely and it makes local builds when switching branches much faster.