mkotsur / artc

Active Read Through Cache

GitHub

Artc Build Status Maven Central Codacy Badge Known Vulnerabilities Cats friendly

Artc (pronounced art┬Ěsy) is an active read-through cache for cats-effect programs.

How Artc works

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}