RedisZ v0.2.0 RedisZ View Source
Pooling & sharding support parallel Redis adapter base on Redix
.
Start RedisZ in your application.
children = [
{RedisZ, name: Example.Redis, pool_size: 4, urls: ["redis://localhost/0", "redis://localhost/1"]},
]
Call RedisZ like Redix.
"OK" = RedisZ.command!(Example.Redis, ["SETEX", "mykey", 10, "Hello"])
[10, "Hello"] = RedisZ.pipeline!(Example.Redis, [["TTL", "mykey"], ["GET", "mykey"]])
You can specify shard like Redis Cluster. {momonga}1
& {momonga}2
are stored at the same shard.
["OK", "OK"] = RedisZ.pipeline!(Example.Redis, ["SET", "{momonga}1", "Hello"], ["SET", "{momonga}2", "Hello"])
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor
Act like Redix.command!/3
through shards & connnection pool
Act like Redix.command/3
through shards & connnection pool
command/3
to each shards & collect the resutls
Act like Redix.pipeline!/3
through shards & connnection pool
Act like Redix.pipeline/3
through shards & connnection pool
pipeline/3
to each shards & collect the resutls
Link to this section Types
args() :: [ server_name: RedisZ.Server.name(), shards_name: RedisZ.Shards.name(), diagnoser_name: RedisZ.Diagnoser.name(), urls: [binary() | keyword()] | binary(), pool_size: pos_integer(), shards: [ name: RedisZ.Shard.name(), diagnoser_name: RedisZ.Diagnoser.name(), pool_name: RedisZ.Pool.name(), pool_size: pos_integer() ] ]
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
command!(RedisZ.Server.name(), Redix.command(), keyword()) :: Redix.Protocol.redis_value() | no_return()
Act like Redix.command!/3
through shards & connnection pool.
command(RedisZ.Server.name(), Redix.command(), keyword()) :: {:ok, Redix.Protocol.redis_value()} | {:error, atom() | Redix.Error.t()}
Act like Redix.command/3
through shards & connnection pool.
command_to_all_shards(RedisZ.Server.name(), Redix.command(), keyword()) :: %{ optional(RedisZ.Shard.name()) => {:ok, Redix.Protocol.redis_value()} | {:error, atom() | Redix.Error.t()} }
command/3
to each shards & collect the resutls.
pipeline!(RedisZ.Server.name(), [Redix.command()], keyword()) :: [Redix.Protocol.redis_value()] | no_return()
Act like Redix.pipeline!/3
through shards & connnection pool.
pipeline(RedisZ.Server.name(), [Redix.command()], keyword()) :: {:ok, [Redix.Protocol.redis_value()]} | {:error, atom() | Redix.Error.t()}
Act like Redix.pipeline/3
through shards & connnection pool.
pipeline_to_all_shards(RedisZ.Server.name(), [Redix.command()], keyword()) :: %{ optional(RedisZ.Shard.name()) => {:ok, [Redix.Protocol.redis_value()]} | {:error, atom() | Redix.Error.t()} }
pipeline/3
to each shards & collect the resutls.