Skip to main content
Scala 3 + Cats Effect

A purely functional Valkey client

Type-safe commands, Resource-managed connections, and a Rust-powered core. Domain errors are values, not exceptions.

App.scala
import cats.effect.*
import dev.profunktor.valkey4cats.Valkey
import dev.profunktor.valkey4cats.model.ValkeyResponse.Ok

object App extends IOApp.Simple:

  def run: IO[Unit] =
    Valkey[IO].utf8("valkey://localhost").use { cmd =>
      for
        _   <- cmd.set("key", "hello, valkey")
        res <- cmd.get("key")
        _   <- res match
          case Ok(Some(v)) => IO.println(s"Got: $v")
          case _            => IO.unit
      yield ()
    }

Built for production Scala

Everything you need to build reliable, high-throughput applications with Valkey.

01

Type-Safe by Design

Tagless final with typed keys and values. Smart constructors validate config at compile time via Codec type class.

02

Purely Functional

Resource-managed connections. Domain errors are values via ValkeyResponse ADT — pattern match, don't catch.

03

Rust-Powered Core

Valkey Glide handles pooling, cluster topology, and client-side caching in its Rust engine. Scala gets the ergonomics.

04

Full Command Coverage

Strings, Hashes, Lists, Sets, Sorted Sets, Streams, Geo, Bitmaps, HyperLogLog, Scripting, and more.

05

Validated Configuration

ip4s types for host/port, Either-based smart constructors, opaque types for database IDs. Invalid states are unrepresentable.

06

Client-Side Caching

Local TTL-based caching with configurable eviction (LRU/LFU) and observable hit/miss metrics.