A module that provides a Redis connection pool using NimblePool.
def deps do
[
{:redis_pool_xyz, "~> 0.1"}
]
end
See DOC
-
Add a module using
RedisPool
:defmodule MyRedis do @moduledoc false use RedisPool, otp_app: :my_app end
-
Configure your Redis:
url = "redis://localhost:6379" config = [url: url] config :my_app, MyRedis, config
-
Add your redis module to supervisor:
children = [ MyRedis ]
-
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"]])