Skip to content
 
 

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RedixPool

Simple Redis pooling built on redix and poolboy.

Installation

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"}]
end

Configuration

RedixPool 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: 1

Basic Usage

RedixPool 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"}

Testing

Currently, the tests assume you have an instance of Redis running locally at localhost:6379.

On OSX, Redis can be installed easily with MacPorts or brew:

sudo port install redis
brew install redis

Once 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.

About

Redix + Poolboy

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages