Skip to content

Instantly share code, notes, and snippets.

View iandebeer's full-sized avatar

Ian de Beer iandebeer

View GitHub Profile

Keybase proof

I hereby claim:

  • I am iandebeer on github.
  • I am jandebeer (https://keybase.io/jandebeer) on keybase.
  • I have a public key ASDb_IZiLaO5fsPJ5wP_XBlOV39lrzgggqyoSCWuT1dv-Qo

To claim this, I am signing this object:

@iandebeer
iandebeer / CachedResource-Blog.md
Created June 11, 2021 08:30 — forked from Daenyth/CachedResource-Blog.md
CachedResource for cats-effect

Concurrent resource caching for cats

Motivation

cats-effect Resource is extremely handy for managing the lifecycle of stateful resources, for example database or queue connections. It gives a main interface of:

trait Resource[F[_], A] {
  /** - Acquire resource
    * - Run f
 * - guarantee that if acquire ran, release will run, even if `use` is cancelled or `f` fails