Artc (pronounced art·sy) is an Active Read-Through Cache for cats-effect programs. Its primary goal is to allow developers to write as little code as possible to solve a common problem of reading data from services with high latency.
Sometimes you need to integrate with slow services. This is rarely a pleasant problem to solve, but it doesn't have to take weeks to solve and destroy your development experience. Artc is here to help!
- Non-blocking read-through;
- Active content synchronization;
- Automatic refresh rate adjustment;
- Use it as a library or a REST microservice (soon).
import io.github.mkotsur.artc.Cache
import cats.effect.{ExitCode, IO, IOApp}
// 1. Configure
case class User(name: String)
val settings: Cache.Settings = ???
val readSource: IO[List[User]] = ???
// 2. Create as resource
val cacheR: Resource[IO, Cache[List[User]]] =
Cache.create(settings, readSource)
// 3. Use
for {
latest <- cacheR.use(cache => cache.latest)
_ <- IO(println(v))
_ <- updateSharesFiber.join
} yield ExitCode.Success
Scala versions supported: 2.13.x.
libraryDependencies += "io.github.mkotsur" %% "artc" % {latest-version}