Skip to content

Commit

Permalink
Format index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
drmarjanovic committed Sep 15, 2024
1 parent b31ae8a commit f815857
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ object ZIORedisExample extends ZIOAppDefault {
def get[A: Schema]: BinaryCodec[A] = ProtobufCodec.protobufCodec
}

val myApp: ZIO[Redis, RedisError, Unit] = for {
redis <- ZIO.service[Redis]
_ <- redis.set("myKey", 8L, expireAt = Some(SetExpire.SetExpireSeconds(1.minutes)))
v <- redis.get("myKey").returning[Long]
_ <- Console.printLine(s"Value of myKey: $v").orDie
_ <- redis.hSet("myHash", ("k1", 6), ("k2", 2))
_ <- redis.rPush("myList", 1, 2, 3, 4)
_ <- redis.sAdd("mySet", "a", "b", "a", "c")
} yield ()
val myApp: ZIO[Redis, RedisError, Unit] =
for {
redis <- ZIO.service[Redis]
_ <- redis.set("myKey", 8L, expireAt = Some(SetExpire.SetExpireSeconds(1.minutes)))
v <- redis.get("myKey").returning[Long]
_ <- Console.printLine(s"Value of myKey: $v").orDie
_ <- redis.hSet("myHash", ("k1", 6), ("k2", 2))
_ <- redis.rPush("myList", 1, 2, 3, 4)
_ <- redis.sAdd("mySet", "a", "b", "a", "c")
} yield ()

override def run =
myApp.provide(Redis.local, ZLayer.succeed[CodecSupplier](ProtobufCodecSupplier))
Expand Down

0 comments on commit f815857

Please sign in to comment.