ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - akdilsiz/elixir-rediscl: A minimal redis client with connection pooling for elixir
A minimal redis client with connection pooling for elixir - akdilsiz/elixir-rediscl
Visit Site

GitHub - akdilsiz/elixir-rediscl: A minimal redis client with connection pooling for elixir

GitHub - akdilsiz/elixir-rediscl: A minimal redis client with connection pooling for elixir

Elixir Redis Client

A minimal redis client with connection pooling

Codacy Badge CircleCI Coverage Status Hex.pm Hex.pm

##TODO List

  • Completed docs
  • All redis commands will be added.

Features

  • Connection pooling
  • Pipe query builder (basic commands)
  • Basic Query commands

Installation

available in Hex, the package can be installed by adding rediscl to your list of dependencies in mix.exs:

def deps do
  [
    {:rediscl, "~> 0.1"}
  ]
end

Documentation

available HexDocs.

Configuration

# Without password
config :rediscl,
    host: {127, 0, 0, 1},
    port: 6379,
    database: 0,
    pool: 15,
    timeout: 15_000

# With password
config :rediscl,
    host: {127, 0, 0, 1},
    port: 6379,
    password: "<password>",
    database: 0,
    pool: 15,
    timeout: 15_000

If do you are using json library?

config :rediscl,
  json_library: Jason

Examples

defmodule Example do
    alias Rediscl

    def example_one do
        {:ok, _} = Rediscl.Query.set("key:1", "value1")
    end

    def example_two do
        {:ok, value} = Rediscl.Query.get("key:1")
    end

    def example_three do
        {:ok, list_values} = Rediscl.Query.mget(["key:1", "key:2", "key:3"])
    end

    def example_jsonable_one do
      ## If you are only going to use it with a key for response
      ## For this example, options are given based on the Jason library.
      {:ok, _} =
        Rediscl.Query.get(%{key: 1}, 
          [{:json_response, true}, {:json_response_opts, [{:keys, :atoms!}]}])
    end
    
    def example_jsonable_two do
      ## If you are only going to use it with key and value.
      {:ok, _} =
        Rediscl.Query.set(%{key: 1}, %{value: 1}, 
          [{:jsonable, true}, {:encode_key, true}])
    end

    def example_jsonable_three do
      ## If you're going to use a query with a lot of keys and a value.
      {:ok, _} =
        Query.smove(%{key: 2}, %{key: 1}, "value3",
          [{:jsonable, true}, {:encode_multiple_keys, true}])
    end

    def example_jsonable_four do
      ## If you're going to use a query with a lot of keys.
      {:ok, _values} = 
        Query.sunion([%{key: 1}, "key:2"],
          [{:jsonable, true}, {:encode_multiple_keys, true}])
    end    
end

defmodule ExamplePipeBuilder do
    import Rediscl.Query.Pipe
    alias Rediscl.Query

    def example do
        query = begin set: ["key:10", "1"],
                      mset: ["key:11", "value2", "key:12", "value3"],
                      lpush: ["key:13", ["-1", "-2", "-3"]],
                      rpush: ["key:14", ["1", "2", "3"]],
                      lrange: ["key:13", 0, "-1"],
                      lrem: ["key:13", 1, "-1"]

        {:ok, results} = Query.run_pipe(query)
    end
end

Use rediscl for Mix.Task

import Mix.Rediscl
alias Rediscl

def run(_) do
    Mix.Task.run "app.start"
    
    ### Your codes
    Rediscl.Query.set("key:1", "value1")
    ### Your codes
end

Contribution

All contributions are welcomed as long as you follow the conventions of Elixir language.

License

MIT

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory