Redis caching?

Hi.

Have anyone tried implement something like:

export const getUser = (id: UserId) => Effect.tryPromise({
  try: () => fetchFromDB(id),
  catch: (cause) => new FailToFetchUser({ cause })
}).pipe(cacheWithRedis("user", someConfiguration))


The idea is that the result of this function gets cached in Redis for X amount of time before hitting the database again.

I'm asking if someone has made something like this before implementing it on my own.
Was this page helpful?