RedisCluster.Pool (redis_cluster v0.8.0)

View Source

Redis Cluster connection supervisor. A "pool" in this context is a set of connections that point to the same Redis node (host and port). A Redis cluster will have a pool of connections for each node in the cluster.

Summary

Functions

Returns a specification to start this module under a supervisor.

Retrieves a connection from the pool based on the host and port. Will return the same connection for the same host and port per process.

Starts a pool of connections for the given node information. The configuration specifies how many connections to start for the given node.

Stops all connections in the pool. This is typically called when the application rediscovers the cluster.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_conn(config, host, port)

@spec get_conn(
  RedisCluster.Configuration.t(),
  host :: binary(),
  port :: non_neg_integer()
) :: pid()

Retrieves a connection from the pool based on the host and port. Will return the same connection for the same host and port per process.

start_pool(config, node_info)

Starts a pool of connections for the given node information. The configuration specifies how many connections to start for the given node.

stop_pool(config)

@spec stop_pool(RedisCluster.Configuration.t()) :: :ok

Stops all connections in the pool. This is typically called when the application rediscovers the cluster.