module Resque::Stat
The stat subsystem. Used to keep track of integer counts.
Get a stat: Stat[name] Incr a stat: Stat.incr(name) Decr a stat: Stat.decr(name) Kill a stat: Stat.clear(name)
Public Instance Methods
<<(stat)
click to toggle source
Increments a stat by one.
# File lib/resque/stat.rb, line 36 def <<(stat) incr stat end
>>(stat)
click to toggle source
Decrements a stat by one.
# File lib/resque/stat.rb, line 49 def >>(stat) decr stat end
[](stat)
click to toggle source
Alias of `get`
# File lib/resque/stat.rb, line 23 def [](stat) get(stat) end
clear(stat)
click to toggle source
Removes a stat from Redis, effectively setting it to 0.
# File lib/resque/stat.rb, line 54 def clear(stat) data_store.clear_stat(stat) end
decr(stat, by = 1)
click to toggle source
For a string stat name, decrements the stat by one.
Can optionally accept a second int parameter. The stat is then decremented by that amount.
# File lib/resque/stat.rb, line 44 def decr(stat, by = 1) data_store.decremet_stat(stat,by) end
get(stat)
click to toggle source
Returns the int value of a stat, given a string stat name.
# File lib/resque/stat.rb, line 18 def get(stat) data_store.stat(stat) end
incr(stat, by = 1)
click to toggle source
For a string stat name, increments the stat by one.
Can optionally accept a second int parameter. The stat is then incremented by that amount.
# File lib/resque/stat.rb, line 31 def incr(stat, by = 1) data_store.increment_stat(stat,by) end
redis()
click to toggle source
Direct access to the Redis instance.
# File lib/resque/stat.rb, line 12 def redis Resque.redis end
Also aliased as: data_store