Skip to content

Releases: profunktor/redis4cats

v0.13.0

01 Apr 09:48
e6f2a18
Compare
Choose a tag to compare

Cross-built against Cats Effect 2, and Scala 2.12.x, 2.13.x and 3.0.0-RC1.

🚀 Changes

🤖 Dependency Updates

v1.0.0-RC1

13 Mar 17:37
f23133c
Compare
Choose a tag to compare

This is the first release candidate with support for Cats Effect 3, thanks to @bplommer for the hard work!

The 1.x.x series will continue to be built against CE3, whereas the current stable 0.x.x series will be built against CE2.

🚀 Changes

🔧 Internal Changes

🤖 Dependency Updates

v0.12.0

05 Mar 18:29
d223d58
Compare
Choose a tag to compare

⚠️ ATTENTION: v0.12.1 breaks binary compatibility, you should stay on v0.12.0 if this is important to you. Otherwise, use v0.13.1. ⚠️

🚀 Changes

  • Remove direct usage of Blocker to ease CE3 transition (#479) @bplommer
  • Improving zRemRangeByScore method interface (#469) @kerzok
  • Pass Lettuce ReadFrom option to cluster connection (#455) @mmienko
  • XREAD id should be the last consumed one (no increment) (#449) @epifab
  • Asynchronous XREAD to prevent constant polling of redis streams (#447) @epifab

🤖 Dependency Updates

v0.11.1

25 Dec 16:53
ec5511f
Compare
Choose a tag to compare

🚀 Changes

  • Transactions: replacing internal delay with synchronizer (#444) @gvolpe

This greatly improves transactions and pipelines' performance while also making them deterministic.

🤖 Dependency Updates

v0.11.0

07 Dec 15:15
7e32445
Compare
Choose a tag to compare

🚀 Changes

Lots of great contributions in this release, thanks to all the contributors ❤️ !

🔧 Internal Changes

📗 Documentation

  • Fix pipelining test + add caveats documentation (#433) @gvolpe
  • Added example of how to setup more fine tuned redis cluster connection (#393) @sshobotov

🤖 Dependency Updates

v0.10.3

16 Sep 09:53
7694923
Compare
Choose a tag to compare

Changes

According to git shortlog v0.10.2.. --no-merges:

Arturas Slajus (2) @arturaz:

  • #365 Fix: hmGet throws an exception if one of the keys doesn't have a value
  • #366 Add hmGet to the tests.

Gabriel Volpe (6) @gvolpe:

  • #337 Ability to convert a standard list to HList
  • #358 Support for PEXPIRE, EXPIREAT & PEXPIREAT

Pierre Ricadat (5) @ghostdogpr:

  • #328 Return MessageId in append
  • #329 Add Streaming constructors that return a Resource
  • #342 Properly split entry IDs
  • #343 Increment sequence number instead of timestamp to get the next offset

quanganhtran (2) @quanganhtran:

  • #333 Implement OBJECT IDLETIME. Closes #332
  • #336 Implement SCAN with arguments. Closes #331

zakolenko (3) @zakolenko:

  • #348 sorted sets: zpopmin, zpopmax, bzpopmin, bzpopmax
  • #349 blpop and brpop: - return F[Option[(K, V)]] instead of F[(K, V)] - accept a non-empty list of keys
  • bzpopmin, bzpopmax: accept Duration instead of FiniteDuration

Dependency updates

Scala Steward (15):

  • Update sbt-scalafmt to 2.4.2
  • Update fs2-core to 2.4.4
  • Update munit, munit-scalacheck to 0.7.12
  • Update cats-core, cats-testkit to 2.2.0
  • Update cats-effect to 2.2.0
  • Update sbt-mdoc to 2.2.7
  • Update lettuce-core to 5.3.4.RELEASE

v0.10.2

05 Jul 13:50
967796c
Compare
Choose a tag to compare

Changes

A single change (forgotten in the previous release)

  • #327 Simplify creation of RedisClient

Previous changes

The tag description on v0.10.1 was messed up so here it is.

Gabriel Volpe (11):
      Examples: Concurrent transactions with optimistic locking [5d703e0]
      filterExec instead of exec [75ed8fc]
      Automated microsite publishing using Nix (#305) [c385285]
      Debug-level logging for transactions and pipelining [235160f]

Scala Steward (14):
      Update lettuce-core to 5.3.1.RELEASE [f0cca46]
      Update munit, munit-scalacheck to 0.7.9 [9e120bc]
      Update fs2-core to 2.4.2 [bb5fce0]
      Update sbt-mdoc to 2.2.3 [00c523f]
      Update sbt-tpolecat to 0.1.13 [6e34081]
      Update sbt to 1.3.13 [fa6c9f3]

Tomasz Szymula (3):
      add xadd xtrim ~ optional param [35788fc]
      change streaming api messages explicitly do xadd/xread + support approxMaxlen param [51da947]

Yannick Heiber (3):
      Add Redis4CatsConfig with ability to control shutdown timeouts [caf577c]
      Simplify RedisClusterClient.apply [75afff0]

v0.10.0

25 May 15:40
Compare
Choose a tag to compare

Breaking changes

A lot has changed since the latest major release 0.9.6 for a greater good. Here's a summary of changes.

Package rename

Before Now
dev.profunktor.redis4cats.algebra.RedisCommands dev.profunktor.redis4cats.RedisCommands
dev.profunktor.redis4cats.interpreter.Redis dev.profunktor.redis4cats.Redis
dev.profunktor.redis4cats.domain._ dev.profunktor.redis4cats.data._
dev.profunktor.redis4cats.interpreter.pubsub.PubSub dev.profunktor.redis4cats.pubsub.PubSub
dev.profunktor.redis4cats.interpreter.streams.RedisStream dev.profunktor.redis4cats.streams.RedisStream
dev.profunktor.redis4cats.streams._ dev.profunktor.redis4cats.pubsub.data._ (*)
dev.profunktor.redis4cats.streams._ dev.profunktor.redis4cats.streams.data._ (*)

(*) It has been split into two different files.

Typed-transactions & Pipelining

Typed-transactions and pipelining now make use of a custom HLists. Types are now fully inferred. For example:

//type Cmd = IO[Unit] :: IO[Unit] :: IO[Option[String]] :: IO[Unit] :: IO[Unit] :: IO[Option[String]] :: HNil
val operations =
  cmd.set(key1, "sad") :: cmd.set(key2, "windows") :: cmd.get(key1) ::
      cmd.set(key1, "nix") :: cmd.set(key2, "linux") :: cmd.get(key1) :: HNil

//type Res = Option[String] :: Option[String] :: HNil
val prog =
  RedisTransaction(cmd)
    .filterExec(operations)
    .flatMap {
      case res1 ~: res2 ~: HNil =>
        putStrLn(s"res1: $res1, res2: $res2")
    }
    .onError {
      case TransactionAborted =>
        putStrLn("[Error] - Transaction Aborted")
      case TransactionDiscarded =>
        putStrLn("[Error] - Transaction Discarded")
      case _: TimeoutException =>
        putStrLn("[Error] - Timeout")
    }

Redis client configuration

A RedisClient can now be configured (timeouts, reconnection, etc) by supplying a ClientOptions. E.g.

import io.lettuce.core.{ ClientOptions, TimeoutOptions }
import java.time.Duration

val mkOpts: IO[ClientOptions] =
  IO {
    ClientOptions.builder()
     .autoReconnect(false)
     .pingBeforeActivateConnection(false)
     .timeoutOptions(
       TimeoutOptions.builder()
        .fixedTimeout(Duration.ofSeconds(10))
        .build()
     )
     .build()
  }

val api: Resource[IO, StringCommands[IO, String, String]] =
  for {
    uri    <- Resource.liftF(RedisURI.make[IO]("redis://localhost"))
    opts   <- Resource.liftF(mkOpts)
    client <- RedisClient[IO](uri, opts)
    redis  <- Redis[IO].fromClient(client, stringCodec)
  } yield redis

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.

Some new constructors now take a ClientOptions argument as well.

  • Redis[IO].withOptions("redis://localhost", opts, codec)
  • RedisClient[IO](uri, opts)
  • RedisMasterReplica[IO].withOptions(codec, uri, opts)

Quick start

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
    }

}

Codecs derivation

Codecs can now derive key types K in addition to value types V. For example:

import dev.profunktor.redis4cats.codecs.Codecs
import dev.profunktor.redis4cats.codecs.splits._
import dev.profunktor.redis4cats.data.RedisCodec

case class Keys(value: String)

val keysSplitEpi: SplitEpi[String, Keys] =
  SplitEpi(Keys.apply, _.value)

val newCodec: RedisCodec[Keys, Long] =
  Codecs.derive(RedisCodec.Utf8, keysSplitEpi, stringLongEpi)

Compression & Encryption codecs

Three new functions have been added to manipulate existing codecs: deflate, gzip, and secure. E.g.

import dev.profunktor.redis4cats.data.RedisCodec

val gzipCodec: RedisCodec[String, String] =
  RedisCodec.gzip(RedisCodec.Utf8) 

All Changes

  • #245 [Feature] - Scan command impl by @oskin1
  • #248 [Docs] - Rename fs2-redis to redis4cats by @zaneli
  • #252 [Docs] - Add documentation section to README by @ybasket
  • #269 [Bugfix] - Fix bugs in zRevRangeWithScores and zRevRangeByScoreWithScores by @taeguk
  • #273 [Feature] - Typed transactions using custom HList
  • #276 [Refactor] - Simpler package naming
  • #277 [Feature] - Pipelining using HLists
  • #278 [Feature] - Filter Unit types from HList
  • #283 [Refactor] - The exec_ function has been renamed to filterExec (transactions and pipelining).
  • #284 [Refactor] - The API has been greatly simplified while also improving type inference
  • #285 [Refactor] - Rename Redis instantiation methods (make => fromClient, etc) by @ybasket
  • #289 [Docs] - Scaladocs as part of the microsite: https://redis4cats.profunktor.dev/api/
  • #292 [Internal] - Migrating tests over to MUnit
  • #293 [Feature] - Stdout logging implementation + docs
  • #295 [Docs] - Codecs documentation (including JsonCodec)
  • #296 [Feature] - Codecs: compression, encryption & docs
  • #297 [Feature] - Client options (to configure the underlying Redis client: timeouts, reconnection, etc)
  • #298 [Internal] - Automating releases from the CI build
  • #299 [Internal] - CI build Dhall definitions
  • #300 [Refactor] - Removing liftK from the commands algebra

Dependency updates

  • #256 fs2-core-2.3.0
  • #279 cats-effect-2.1.3
  • #270 lettuce-core-5.3.0.RELEASE
  • #288 log4cats-1.1.1

Thanks to all the contributors! 🎉

v0.10.0-RC5

22 May 10:53
Compare
Choose a tag to compare

Testing the automated release process (2).

v0.10.0-RC4

21 May 18:23
4cbd328
Compare
Choose a tag to compare

Testing the automated release process.