To use Caffeine (an in-memory cache), add the scalacache-caffeine dependency to your SBT project.
You can either use the default settings via CaffeineCache[IO, K, V].unsafeRunSync() or provide a custom com.github.benmanes.caffeine.cache.Cache instance to control parameters like maximumSize.
// Using default settings
import scalacache._
import scalacache.caffeine._
import cats.effect.{Clock, IO}
import cats.effect.unsafe.implicits.global
implicit val clock: Clock[IO] = Clock[IO]
implicit val caffeineCache: Cache[IO, String, String] = CaffeineCache[IO, String, String].unsafeRunSync()
// Using a customized Caffeine instance
import com.github.benmanes.caffeine.cache.Caffeine
val underlyingCaffeineCache = Caffeine.newBuilder().maximumSize(10000L).build[String, Entry[String]]
implicit val customisedCaffeineCache: Cache[IO, String, String] = CaffeineCache(underlyingCaffeineCache)