code: def cache_jobs(opts, jid, ret):
      '''
      Write job information to cache
      '''
      serial = salt.payload.Serial(opts=opts)
  
      fn_ = os.path.join(
          opts['cachedir'],
          'minion_jobs',
          jid,
          'return.p')
      jdir = os.path.dirname(fn_)
      if not os.path.isdir(jdir):
          os.makedirs(jdir)
      with salt.utils.files.fopen(fn_, 'w+b') as fp_:
          fp_.write(serial.dumps(ret)f cache_jobs(opts, jid, ret):
      '''
      Write job information to cache
      '''
      serial = salt.payload.Serial(opts=opts)
  
      fn_ = os.path.join(
          opts['cachedir'],
          'minion_jobs',
          jid,
          'return.p')
      jdir = os.path.dirname(fn_)
      if not os.path.isdir(jdir):
          os.makedirs(jdir)
      with salt.utils.files.fopen(fn_, 'w+b') as fp_:
          fp_.write(serial.dumps(ret))
docs: Write job information to cache