tt67wq / redis_pool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RedisPool

A module that provides a Redis connection pool using NimblePool.

Installation

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

See DOC

Usage

  1. Add a module using RedisPool:

    defmodule MyRedis do
      @moduledoc false
    
      use RedisPool, otp_app: :my_app
    
    end
  2. Configure your Redis:

    url = "redis://localhost:6379"
    config = [url: url]
    config :my_app, MyRedis, config
  3. Add your redis module to supervisor:

    children = [
       MyRedis
    ]
  4. Enjoy your journey!

    MyRedis.command(["GET", "foo"]) == {:ok, nil}
    MyRedis.command(["SET", "foo", "bar"]) == {:ok, "OK"}
    MyRedis.command(["GET", "foo"]) == {:ok, "bar"}
    MyReids.pipeline([["SET", "foo1", "bar1"], ["SET", "foo2", "bar2"]])

About


Languages

Language:Elixir 100.0%