Module: Stats

Extended by:
Stats, Helpers, Times
Included in:
Stats
Defined in:
lib/stats.rb,
lib/stats/times.rb,
lib/stats/helpers.rb,
lib/stats/timing_stat.rb

Defined Under Namespace

Modules: Helpers, Times Classes: TimingStat

Instance Method Summary collapse

Methods included from Helpers

redis, redis=

Methods included from Times

get_times, time

Instance Method Details

#clear(name) ⇒ Object

Clears the stat with the specified name.



38
39
40
# File 'lib/stats.rb', line 38

def clear(name)
  Stats.redis.del(name)
end

#counter(name) ⇒ Object

Returns the value of the counter with the specified name.



33
34
35
# File 'lib/stats.rb', line 33

def counter(name)
  Stats.redis.get(name).to_i
end

#decr(name, by = 1) ⇒ Object

Decrements the stat with the specified name.



28
29
30
# File 'lib/stats.rb', line 28

def decr(name, by = 1)
  Stats.redis.decrby(name, by)
end

#get(name) ⇒ Object

Returns the value with the specified name.



18
19
20
# File 'lib/stats.rb', line 18

def get(name)
  Stats.redis.get(name)
end

#incr(name, by = 1) ⇒ Object

Increments the stat with the specified name.



23
24
25
# File 'lib/stats.rb', line 23

def incr(name, by = 1)
  Stats.redis.incrby(name, by)
end

#set(name, value) ⇒ Object

Sets the stat with the specified name.



13
14
15
# File 'lib/stats.rb', line 13

def set(name, value)
  Stats.redis.set(name, value)
end