an env variable such as TRAVIS_CACHE_RESULT which is set to either true or false after the cache components script is completed can result in great reduction in build times… we can check for the variable in before_install part and act accordingly whether to skip the install part or not… This is when we have directories which contain some compiled libraries that need to cached for future builds.
I am not sure if I understand the use case for this variable. You know what is being cached. Whether or not caching succeeded is much less important than what files are available to the build, which is by and large context-dependent.
Since boost is not available for windows our project is compiling it from sources which is taking around half the total build time… if we could cache the resulted compiled boost and check whether retrieval of the cache has succeeded or not, we can skip the boost compilation part and do the actual build part… its not only about windows we are also doing this for cross compilation to support arm.
Generally, the environment variable will not help your use case. Instead, you should check for existence of the files you are interested in.