function expensiveOperation (input) {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      const output = 'result'
      cache.write(input, output)
      resolve(output)
    }, 3000)
  })
}
function expensiveOperation (input) {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      const output = 'result'
      cache.write(input, output)
      resolve(output)
    }, 3000)
  })
}
function expensiveOperation ( input ) { return new Promise ( ( resolve , reject ) => { setTimeout ( ( ) => { const output = 'result' cache . write ( input , output ) resolve ( output ) } , 3000 ) } ) }
The expensive operation we're aiming to avoid, (3 second cost per invocation)
The expensive operation we re aiming to avoid ( 3 second cost per invocation )