Popularity
3.3
Declining
Activity
0.0
Stable
13
6
2

Monthly Downloads: 104
Programming language: Elixir
License: MIT License

rediscl alternatives and similar packages

Based on the "ORM and Datamapping" category.
Alternatively, view rediscl alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of rediscl or a related project?

Add another 'ORM and Datamapping' Package

README

Elixir Redis Client

A minimal redis client with connection pooling (using eredis and poolboy)

Codacy Badge Build Status 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

config :rediscl,
    host: "127.0.0.1",
    port: 6379,
    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


*Note that all licence references and agreements mentioned in the rediscl README section above are relevant to that project's source code only.