ExRedisPool v0.2.1 ExRedisPool.Shard
Interface module for working with sharded Redis clusters.
Supervisor for ShardMappers.
Each child of this supervisor is a process that maps queries to their appropriate Redis shard.
In this context, a shard is simply a RedisPool process. By combining a group of RedisPool processes we can map a workload onto more than one instance of Redis.
Summary
Functions
Start a new shard_mapper
Like new/1
but with the option to give an atom name
Run a synchronous redis query (sharded)
Like q/3 except returns the result directly or raises an error (sharded)
Run an asynchronous redis query
Run a synchronous query pipeline
Like qp/3 except returns the result directly or raises an error
Run an asynchronous query pipeline
Types
redis_pool_option :: {:host, binary} | {:port, integer} | {:database, binary} | {:password, binary} | {:reconnect_sleep, reconnect_sleep} | {:sync_pool_size, integer} | {:sync_pool_max_overflow, integer} | {:async_pool_size, integer} | {:async_pool_max_overflow, integer}
Functions
Start a new shard_mapper.
Takes a list of connection options for each shard. Each shard is assigned an index based on the order of the connection options.
Like new/1
but with the option to give an atom name.
q(mapper, redis_query, binary, integer) :: {:ok, redis_result} | {:error, reason}
Run a synchronous redis query (sharded).
q!(mapper, redis_query, binary, integer) :: redis_result | no_return
Like q/3 except returns the result directly or raises an error (sharded).
q_noreply(mapper, redis_query, binary) :: :ok | {:error, reason}
Run an asynchronous redis query.
This function takes the requested query and queues it in a separate pool from the synchronous queries so bulk asynchronous queries do not degrade quality of service for synchronous queries.
qp(mapper, [redis_query], binary, integer) :: [{:ok, redis_result}] | {:error, reason}
Run a synchronous query pipeline.
qp!(mapper, [redis_query], binary, integer) :: [redis_result] | no_return
Like qp/3 except returns the result directly or raises an error.
qp_noreply(mapper, [redis_query], binary) :: :ok | {:error, reason}
Run an asynchronous query pipeline.
This function takes the requested query pipeline and queues it in a separate pool from the synchronous query pipelines so bulk asynchronous query pipelines do not degrade quality of service for synchronous query pipelines.