def check_cache(self, vts, counter):
    """Manually checks the artifact cache (usually immediately before compilation.)

    Returns true if the cache was hit successfully, indicating that no compilation is necessary.
    """
    if not self.artifact_cache_reads_enabled():
      return False
    cached_vts, _, _ = self.check_artifact_cache([vts])
    if not cached_vts:
      self.context.log.debug('Missed cache during double check for {}'
        .format(vts.target.address.spec))
      return False
    assert cached_vts == [vts], (
      'Cache returned unexpected target: {} vs {}'.format(cached_vts, [vts])
    )
    self.context.log.info('Hit cache during double check for {}'.format(vts.target.address.spec))
    counter()
    return True
Manually checks the artifact cache (usually immediately before compilation.)

    Returns true if the cache was hit successfully, indicating that no compilation is necessary.