method Cache.prototype.getOrSet Cache.prototype.getOrSet<T>(key: string,fn: () => Promisable<T>,options?: SetOptions,): Task<T, CacheGetFailed | CacheSetFailed> Get a value, or compute and store it on cache miss. Examples Example 1 const user = await cache.getOrSet<User>( `user:${id}`, () => db.query("SELECT * FROM users WHERE id = ?", [id]), { ttl: 60_000 }, ).run(); Type Parameters T Parameters key: string fn: () => Promisable<T> optional options: SetOptions Return Type Task<T, CacheGetFailed | CacheSetFailed>