Class: ConsoleKit::Connections::RedisConnectionHandler
Overview
Handles Redis connections
Constant Summary
collapse
- DEFAULT_REDIS_DB =
0
Instance Attribute Summary
#context
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize, registry, #safe_diagnostics
clock_time, error_diagnostics, timeout_diagnostics
Class Method Details
.redis_client ⇒ Object
12
|
# File 'lib/console_kit/connections/redis_connection_handler.rb', line 12
def redis_client = Redis.try(:current)
|
.warn_no_auto_select(db_index) ⇒ Object
14
15
16
17
|
# File 'lib/console_kit/connections/redis_connection_handler.rb', line 14
def warn_no_auto_select(db_index)
Output.print_warning("Redis DB #{db_index} configured but auto-select not supported with RedisClient. " \
'Ensure your Redis configuration sets the correct DB.')
end
|
Instance Method Details
#available? ⇒ Boolean
26
|
# File 'lib/console_kit/connections/redis_connection_handler.rb', line 26
def available? = defined?(Redis)
|
#connect ⇒ Object
20
21
22
23
24
|
# File 'lib/console_kit/connections/redis_connection_handler.rb', line 20
def connect
db_index = context_attribute(:tenant_redis_db) || DEFAULT_REDIS_DB
Output.print_info(switch_message(db_index))
select_redis_db(db_index)
end
|
#diagnostics ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/console_kit/connections/redis_connection_handler.rb', line 28
def diagnostics
redis = self.class.redis_client if available?
return unavailable_diagnostics('Redis') unless redis
perform_diagnostics(redis)
rescue StandardError => e
error_diagnostics('Redis', e)
end
|