async cache()

in app/launch/src/helpers/Cache.js [79:95]


  async cache(KEY, callback, ttl = CACHE_EXPIRATION_DEFAULT) {
    const item = this._adapter.getItem(KEY)
    if (item) {
      const { value: cached, expiration } = item
      if (expiration > Date.now()) {
        return cached
      }
    }

    const value = await callback()
    this._adapter.setItem(KEY, {
      expiration: Date.now() + ttl,
      value,
    })

    return value
  }