SOURCE

const cacheMap = {}

const getOriginData = (param, request, callback) => {
    const newData = await request(param)
    cashData[paramKey] = res
    callback()

}

const inline = (param, callback, request) => {
  const cashData = {}
  const paramKey = JSON.stringify(param)
  return async () => {
    let res
    if (cashData[paramKey]) {
       res = 'cash' + cashData[paramKey]
    }
    getOriginData(param, request, callback)
    return res
  }
}

const cashRequest = async (param) => {
  return await inline(
    param,
    () => { console.log('新获取的值') },
    new Promise((resolve) => setTimeout(() => {
      resolve('666')
    }, 1000))
  )
}
console 命令行工具 X clear

                    
>
console