RedisPool
A module that provides a Redis connection pool using NimblePool.
Installation
def deps do
[
{:redis_pool_xyz, "~> 0.1"}
]
end
See DOC
Usage
-
Add a module using
RedisPool:defmodule MyRedis do@moduledoc falseuse RedisPool, otp_app: :my_append -
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"]])