Module: Redis::TimeSeries::Client
- Included in:
- Redis::TimeSeries
- Defined in:
- lib/redis/time_series/client.rb
Overview
The client module handles connection management for individual time series, and the parent Redis::TimeSeries class methods. You can enable or disable debugging, and set a default Redis client to use for time series objects.
Class Method Summary collapse
Instance Method Summary collapse
-
#debug ⇒ Boolean
Check debug status.
-
#debug=(bool) ⇒ Boolean
Enable or disable debug output for time series commands.
-
#redis ⇒ Redis
The current Redis client.
-
#redis=(client) ⇒ Redis
Set the default Redis client for time series objects.
Class Method Details
.extended(base) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/redis/time_series/client.rb', line 10 def self.extended(base) base.class_eval do attr_reader :redis private def cmd(name, *args) self.class.send :cmd_with_redis, redis, name, *args end end end |
Instance Method Details
#debug ⇒ Boolean
Check debug status. Defaults to on with DEBUG=true environment variable.
24 25 26 |
# File 'lib/redis/time_series/client.rb', line 24 def debug @debug.nil? ? [true, 'true', 1].include?(ENV['DEBUG']) : @debug end |
#debug=(bool) ⇒ Boolean
Enable or disable debug output for time series commands. Enabling debug will print commands to STDOUT
as they’re executed.
41 42 43 |
# File 'lib/redis/time_series/client.rb', line 41 def debug=(bool) @debug = !!bool end |
#redis ⇒ Redis
Returns the current Redis client. Defaults to Redis.new
.
46 47 48 |
# File 'lib/redis/time_series/client.rb', line 46 def redis @redis ||= Redis.new end |
#redis=(client) ⇒ Redis
Set the default Redis client for time series objects. This may be useful if you already use a non-time-series Redis database, and want to use both at the same time.
60 61 62 |
# File 'lib/redis/time_series/client.rb', line 60 def redis=(client) @redis = client end |