Module: RedisQueuedLocks::Swarm::RedisClientBuilder Private

Defined in:
lib/redis_queued_locks/swarm/redis_client_builder.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 1.9.0

Class Method Summary collapse

Class Method Details

.build(pooled: false, sentinel: false, config: {}, pool_config: {}) ⇒ RedisClient|RedisClient::Pooled

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:disable Style/RedundantAssignment

Parameters:

  • pooled (Hash) (defaults to: false) —

    a customizable set of options

  • sentinel (Hash) (defaults to: false) —

    a customizable set of options

  • config (Hash) (defaults to: {}) —

    a customizable set of options

Options Hash (pooled:):

  • (Boolean)

Options Hash (sentinel:):

  • (Boolean)

Options Hash (config:):

  • (Hash)

Returns:

  • (RedisClient|RedisClient::Pooled)

Since:

  • 1.9.0



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/redis_queued_locks/swarm/redis_client_builder.rb', line 15

def build(pooled: false, sentinel: false, config: {}, pool_config: {})
  config.transform_keys!(&:to_sym)
  pool_config.transform_keys!(&:to_sym)

  redis_config =
    sentinel ? sentinel_config(config) : non_sentinel_config(config)
  redis_client =
    pooled ? pooled_client(redis_config, pool_config) : non_pooled_client(redis_config)

  redis_client
end