Skip to content

followanalytics/redix_pool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RedixPool

Simple Redis pooling built on redix and poolboy.

circleci-shield

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 brew:

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.

Packages

No packages published

Languages

  • Elixir 100.0%