code: def _should_cache_target_dir(self, vt):
      
      return (
        self.cache_target_dirs and
        vt.cacheable and
        (not vt.is_incremental or self.cache_incremental) and
        self.artifact_cache_writes_enabled()
      )
docs: Return true if the given vt should be written to a cache (if configured).