Lists API
Purely functional interface for the Lists API.
List Commands usage
Once you have acquired a connection you can start using it:
import cats.effect.IO
val testKey = "listos"
def putStrLn(str: String): IO[Unit] = IO(println(str))
commandsApi.use { redis => // ListCommands[IO, String, String]
for {
_ <- redis.rPush(testKey, "one", "two", "three")
x <- redis.lRange(testKey, 0, 10)
_ <- putStrLn(s"Range: $x")
y <- redis.lLen(testKey)
_ <- putStrLn(s"Length: $y")
a <- redis.lPop(testKey)
_ <- putStrLn(s"Left Pop: $a")
b <- redis.rPop(testKey)
_ <- putStrLn(s"Right Pop: $b")
z <- redis.lRange(testKey, 0, 10)
_ <- putStrLn(s"Range: $z")
} yield ()
}