Artc (pronounced art·sy) is an active read-through cache for cats-effect programs.
Example
import io.github.mkotsur.artc.ActiveReadThroughCache
import cats.effect.{ExitCode, IO, IOApp}
case class User(name: String)
val settings: ActiveReadThroughCache.Settings = ???
val readSource: IO[List[User]] = ???
for {
cache <- ActiveReadThroughCache.create(settings, readSource)
updateSharesFiber <- cache.scheduleUpdates.start
_ <- {
// Your logic goes here
cache.mostRecent.flatMap(v => IO(println(v)))
}
_ <- updateSharesFiber.join
} yield ExitCode.Success
Adding to your project
Scala versions supported: 2.13.x.
libraryDependencies += "io.github.mkotsur" %% "artc" % {latest-version}