25.3. Not Using the Shared Cache for Specific Files

You may want to disable caching for certain specific files in your configuration. For example, if you only want to put executable files in a central cache, but not the intermediate object files, you can use the NoCache function to specify that the object files should not be cached:


       env = Environment()
       obj = env.Object('hello.c')
       env.Program('hello.c')
       CacheDir('cache')
       NoCache('hello.o')
    

Then when you run scons after cleaning the built targets, it will recompile the object file locally (since it doesn't exist in the shared cache directory), but still realize that the shared cache directory contains an up-to-date executable program that can be retrieved instead of re-linking:


      % scons -Q
      cc -o hello.o -c hello.c
      cc -o hello hello.o
      % scons -Q -c
      Removed hello.o
      Removed hello
      % scons -Q
      cc -o hello.o -c hello.c
      Retrieved `hello' from cache