RedisCluster.ShardDiscovery (redis_cluster v0.8.0)

View Source

A GenServer that discovers Redis shards in a cluster and manages the connection pools. This module doesn't actively monitor the cluster for changes. Instead it waits for a call to rediscover_shards/1 to trigger a discovery process. This generally happens when a MOVED redirect is encountered, indicating the cluster topology has changed.

Summary

Functions

Returns a specification to start this module under a supervisor.

Triggers a rediscovery of the shards in the cluster. You shouldn't need to call this function directly in most cases, as the cluster will automatically handle shard discovery when needed.

Triggers a rediscovery of the shards in the cluster asynchronously. This function returns immediately without waiting for the discovery to complete.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

rediscover_shards(config)

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

Triggers a rediscovery of the shards in the cluster. You shouldn't need to call this function directly in most cases, as the cluster will automatically handle shard discovery when needed.

This function waits for the discovery to complete before returning.

rediscover_shards_async(config)

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

Triggers a rediscovery of the shards in the cluster asynchronously. This function returns immediately without waiting for the discovery to complete.

If a discovery is already in progress, this call is ignored (no duplicate work).