def save_cache(data, config):
 dpath = config.get('cache', 'cache_dir')
 try:
  cache = open('/'.join([dpath, 'inventory']), 'w')
  cache.write(json.dumps(data))
  cache.close()
 except IOError as e:
  pass

def save_cache ( data , config ) : dpath = config . get ( 'cache' , 'cache_dir' ) try : cache = open ( '/' . join ( [ dpath , 'inventory' ] ) , 'w' ) cache . write ( json . dumps ( data ) ) cache . close ( ) except IOError as e : pass
saves item to cache .