code: def cache_local_file(path):
      '''
      Cache a local file on the minion in the localfiles cache
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' cp.cache_local_file /etc/hosts
      '''
      if not os.path.exists(path):
          return ''
  
      path_cached = is_cached(path)
  
      # If the file has already been cached, return the path
      if path_cached:
          path_hash = hash_file(path)
          path_cached_hash = hash_file(path_cached)
  
          if path_hash['hsum'] == path_cached_hash['hsum']:
              return path_cached
  
      # The file hasn't been cached or has changed; cache it
      return _client().cache_local_file(pathf cache_local_file(path):
      '''
      Cache a local file on the minion in the localfiles cache
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' cp.cache_local_file /etc/hosts
      '''
      if not os.path.exists(path):
          return ''
  
      path_cached = is_cached(path)
  
      # If the file has already been cached, return the path
      if path_cached:
          path_hash = hash_file(path)
          path_cached_hash = hash_file(path_cached)
  
          if path_hash['hsum'] == path_cached_hash['hsum']:
              return path_cached
  
      # The file hasn't been cached or has changed; cache it
      return _client().cache_local_file(path)
docs: Cache a local file on the minion in the localfiles cache
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' cp.cache_local_file /etc/hosts