Skip to content

0.10.0-RC2

Compare
Choose a tag to compare
@gvolpe gvolpe released this 11 May 20:39
· 401 commits to master since this release

More breaking changes

  • #283 The exec_ function has been renamed to filterExec (transactions and pipelining).
  • #284 The API has been greatly simplified while also improving type inference

A new quick start section has been added to the documentation:

import cats.effect._
import cats.implicits._
import dev.profunktor.redis4cats.Redis
import dev.profunktor.redis4cats.effect.Log.NoOp._

object QuickStart extends IOApp {

  override def run(args: List[String]): IO[ExitCode] =
    Redis[IO].utf8("redis://localhost").use { cmd =>
      for {
        _ <- cmd.set("foo", "123")
        x <- cmd.get("foo")
        _ <- cmd.setNx("foo", "should not happen")
        y <- cmd.get("foo")
        _ <- IO(println(x === y)) // true
      } yield ExitCode.Success
    }

}

New constructors

  • Redis[IO].utf8("redis://localhost")
  • Redis[IO].simple("redis://localhost", longCodec)
  • Redis[IO].clusterUtf8("redis://localhost:30001")
  • Redis[IO].cluster("redis://localhost:30001", someCodec)

This greatly simplifies the creation of RedisCommands[F, K, V] while improving type inference (note that K and V are inferred from the codec passed as an argument) thanks to the partially applied trick.