Class: Flamingo::Stats::Events
- Inherits:
-
Object
- Object
- Flamingo::Stats::Events
- Defined in:
- lib/flamingo/stats/events.rb
Constant Summary collapse
- ALL_COUNT =
"events:all_count"
- RATE =
"events:rate"
- LAST_TIME =
"events:last_time"
- TYPE_COUNT =
"events:%s_count"
- TWEET_COUNT =
TYPE_COUNT % [:tweet]
Instance Method Summary collapse
- #all_count ⇒ Object
- #event!(type) ⇒ Object
-
#initialize ⇒ Events
constructor
A new instance of Events.
- #last_time ⇒ Object
- #tweet_count ⇒ Object
- #type_count(type) ⇒ Object
Constructor Details
Instance Method Details
#all_count ⇒ Object
25 26 27 |
# File 'lib/flamingo/stats/events.rb', line 25 def all_count .get(ALL_COUNT) || 0 end |
#event!(type) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/flamingo/stats/events.rb', line 18 def event!(type) @rate_counter.event! .incr(ALL_COUNT) .set(LAST_TIME,Time.now.to_i) .incr(TYPE_COUNT % [type]) end |
#last_time ⇒ Object
29 30 31 |
# File 'lib/flamingo/stats/events.rb', line 29 def last_time .get(LAST_TIME) end |
#tweet_count ⇒ Object
37 38 39 |
# File 'lib/flamingo/stats/events.rb', line 37 def tweet_count type_count(:tweet) end |
#type_count(type) ⇒ Object
33 34 35 |
# File 'lib/flamingo/stats/events.rb', line 33 def type_count(type) .get(TYPE_COUNT % [type]) || 0 end |