Class: SimpleApm::RedisKey
- Inherits:
-
Object
- Object
- SimpleApm::RedisKey
- Defined in:
- lib/simple_apm/redis.rb
Class Method Summary collapse
- .[](key, _date = nil) ⇒ Object
- .query_date ⇒ Object
- .query_date=(d = nil) ⇒ Object
- .set_query_date(d = nil) ⇒ Object
Class Method Details
.[](key, _date = nil) ⇒ Object
103 104 105 |
# File 'lib/simple_apm/redis.rb', line 103 def [](key, _date = nil) "#{_date||query_date}:#{key}" end |
.query_date ⇒ Object
99 100 101 |
# File 'lib/simple_apm/redis.rb', line 99 def query_date Thread.current['apm_query_date'] || Time.now.strftime('%Y-%m-%d') end |
.query_date=(d = nil) ⇒ Object
95 96 97 |
# File 'lib/simple_apm/redis.rb', line 95 def query_date=(d = nil) Thread.current['apm_query_date'] = d end |
.set_query_date(d = nil) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/simple_apm/redis.rb', line 83 def set_query_date(d = nil) if block_given? _ = query_date Thread.current['apm_query_date'] = d res = yield Thread.current['apm_query_date'] = _ res else Thread.current['apm_query_date'] = d end end |