View Source LibRedis.Pool (lib_redis v0.1.0)
libredis-pool
LibRedis.Pool
Wrap redix with nimble_pool
usage
Usage
iex> pool = LibRedis.Pool.new(name: :redis_pool, pool_size: 5, url: "redis://:123456@localhost:6379")
iex> {:ok, _} = LibRedis.Pool.start_link(pool: pool)
iex> LibRedis.Pool.command(pool, ["SET", "foo", "bar"])
{:ok, "OK"}
iex> LibRedis.Pool.pipeline(pool, [["SET", "foo", "bar"], ["SET", "bar", "foo"]])
{:ok, ["OK", "OK"]]}
Link to this section Summary
Functions
delegate to Redix.command/2
create new redis pool instance
delegate to Redix.pipeline/2
start redis with nimble pool
Link to this section Types
@type t() :: %LibRedis.Pool{ name: GenServer.name(), pool_size: non_neg_integer(), url: String.t() }
Link to this section Functions
delegate to Redix.command/2
examples
Examples
iex> LibRedis.Pool.command(pool, ["SET", "foo", "bar"])
{:ok, "OK"}
create new redis pool instance
examples
Examples
iex> LibRedis.Pool.new()
delegate to Redix.pipeline/2
examples
Examples
iex> LibRedis.Pool.pipeline(pool, [["SET", "foo", "bar"], ["SET", "bar", "foo"]])
{:ok, ["OK", "OK"]]}
@spec start_link(keyword()) :: GenServer.on_start()
start redis with nimble pool
examples
Examples
iex> LibRedis.Pool.start_link(pool: LibRedis.Pool.new())