Configure cache per a job

For my Rust project, I am using codecov.io for code coverage, and for that I’m using cargo-travis.

The problem is that cargo-travis takes quite a while (around 20mins) to be installed, so I decided to enable cache for cargo.

That was fine… Till I realized that on Windows and OSX builds, and even Linux rust:nightly and rust:beta, the cache isn’t really used for it and it still reinstalls everything. The worst part about it, is that it’s not even needed here as I’m using that only for codecov…

So I wrapped my before_script block in an if statement that would stop it from redownloading/installing the thing completely because it’s pointless here:

before_script: |
  if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_RUST_VERSION" == "stable" ]]; then
    export PATH=$HOME/.cargo/bin:$PATH
    cargo install cargo-update || echo "cargo-update already installed"
    cargo install cargo-travis || echo "cargo-travis already installed"
    cargo install-update -a
  fi

Now it’s doing quite well (dropped down to around the same time it used to run before), but I noticed that now (again, on windows was most noticeable), travis pulls the cache before doing anything, and that wastes 87s(!).

I know that I will have to modify my caching later on, but I’d prefer to completely disable cache for everything ever except a single job, is that possible?

I only want to cache & use what I mentioned earlier only when I’m running on rust:stable and os:linux.

This is my full .travis.yml for reference at the time of writing this question.