GithubHelp home page GithubHelp logo

0pg / zio-redis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zio/zio-redis

0.0 0.0 0.0 1.69 MB

A ZIO-based redis client

Home Page: https://zio.github.io/zio-redis

License: Apache License 2.0

Shell 0.06% Scala 99.94%

zio-redis's Introduction

ZIO Redis

ZIO Redis is a ZIO native Redis client.

The client is still a work-in-progress. Watch this space!

Experimental CI Badge Sonatype Snapshots ZIO Redis

Introduction

ZIO Redis is in the experimental phase of development, but its goals are:

  • Type Safety
  • Performance
  • Minimum Dependency
  • ZIO Native

Installation

Since the ZIO Redis is in the experimental phase, it is not released yet, but we can use snapshots:

libraryDependencies += "dev.zio" %% "zio-redis" % "<version>"

Example

To execute our ZIO Redis effect, we should provide the RedisExecutor layer to that effect. To create this layer we should also provide the following layers:

  • RedisConfig — Using default one, will connect to the localhost:6379 Redis instance.
  • BinaryCodec — In this example, we are going to use the built-in ProtobufCodec codec from zio-schema project.

To run this example we should put following dependencies in our build.sbt file:

libraryDependencies ++= Seq(
  "dev.zio" %% "zio-redis" % "<version>",
  "dev.zio" %% "zio-schema-protobuf" % "0.3.0"
)
import zio._
import zio.redis._
import zio.schema.codec._

object ZIORedisExample extends ZIOAppDefault {
  val myApp: ZIO[Redis, RedisError, Unit] = for {
    redis <- ZIO.service[Redis]
    _     <- redis.set("myKey", 8L, Some(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(
    RedisLive.layer,
    RedisExecutor.layer,
    ZLayer.succeed(RedisConfig.Default),
    ZLayer.succeed[BinaryCodec](ProtobufCodec)
  )
}

Resources

  • ZIO Redis by Dejan Mijic — Redis is one of the most commonly used in-memory data structure stores. In this talk, Dejan will introduce ZIO Redis, a purely functional, strongly typed client library backed by ZIO, with excellent performance and extensive support for nearly all of Redis' features. He will explain the library design using the bottom-up approach - from communication protocol to public APIs. Finally, he will wrap the talk by demonstrating the client's usage and discussing its performance characteristics.

Documentation

Learn more on the ZIO Redis homepage!

Contributing

For the general guidelines, see ZIO contributor's guide.

Code of Conduct

See the Code of Conduct

Support

Come chat with us on Badge-Discord.

License

License

zio-redis's People

Contributors

scala-steward avatar mijicd avatar renovate[bot] avatar anovakovic01 avatar jxnu-liguobin avatar rfmejia avatar anatolysergeev avatar hcwilhelm avatar justinhj avatar khajavi avatar aleksandarskrbic avatar helanto avatar mvelimir avatar github-actions[bot] avatar paulpdaniels avatar geoffjohn11 avatar sloanesturz avatar mschuwalow avatar landlockedsurfer avatar quelgar avatar jgoday avatar gagandeepkalra avatar adamgfraser avatar drmarjanovic avatar kostjas avatar maciejbak85 avatar m-kalai avatar msvaljek avatar ghostdogpr avatar softinio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.