code: def write_cache(cache, opts):
      '''
      Write the mount cache file.
      '''
      cache_file = get_cache(opts)
  
      try:
          _cache = salt.utils.stringutils.to_bytes(
              salt.utils.yaml.safe_dump(cache)
          )
          with salt.utils.files.fopen(cache_file, 'wb+') as fp_:
              fp_.write(_cache)
          return True
      except (IOError, OSError):
          log.error('Failed to cache mounts',
                    exc_info_on_loglevel=logging.DEBUG)
          return Falsf write_cache(cache, opts):
      '''
      Write the mount cache file.
      '''
      cache_file = get_cache(opts)
  
      try:
          _cache = salt.utils.stringutils.to_bytes(
              salt.utils.yaml.safe_dump(cache)
          )
          with salt.utils.files.fopen(cache_file, 'wb+') as fp_:
              fp_.write(_cache)
          return True
      except (IOError, OSError):
          log.error('Failed to cache mounts',
                    exc_info_on_loglevel=logging.DEBUG)
          return False
docs: Write the mount cache file.