Simple Redis pooling built on redix and poolboy.
If available in Hex, the package can be installed
by adding redix_pool to your list of dependencies in mix.exs:
def deps do
[{:redix_pool, "~> 0.1.0"}]
endRedixPool currently only supports a few basic configuration options:
# myapp/config/config.exs
use Mix.Config
config :redix_pool,
redis_url: "redis://localhost:6379",
pool_size: {:system, "POOL_SIZE"}, # System.get_env("POOL_SIZE") will be executed at runtime
pool_max_overflow: 1RedixPool supports command/2 and pipeline/2 (and their bang variants), which are just like the Redix command/3 and pipeline/3 functions, except RedixPool handles the connection for you.
This means using command is as simple as:
alias RedixPool, as: Redis
Redis.command(["FLUSHDB"])
#=> {:ok, "OK"}
Redis.command(["SET", "foo", "bar"])
#=> {:ok, "OK"}
Redis.command(["GET", "foo"])
#=> {:ok, "bar"}Currently, the tests assume you have an instance of Redis running locally at localhost:6379.
On OSX, Redis can be installed easily with brew:
brew install redisOnce you have Redis running, simply run mix test.
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/redix_pool.