Class: Resque::DataStore::StatsAccess

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/data_store.rb

Instance Method Summary collapse

Constructor Details

#initialize(redis) ⇒ StatsAccess

Returns a new instance of StatsAccess.



313
314
315
# File 'lib/resque/data_store.rb', line 313

def initialize(redis)
  @redis = redis
end

Instance Method Details

#clear_stat(stat) ⇒ Object



328
329
330
# File 'lib/resque/data_store.rb', line 328

def clear_stat(stat)
  @redis.del("stat:#{stat}")
end

#decremet_stat(stat, by = 1) ⇒ Object



324
325
326
# File 'lib/resque/data_store.rb', line 324

def decremet_stat(stat, by = 1)
  @redis.decrby("stat:#{stat}", by)
end

#increment_stat(stat, by = 1) ⇒ Object



320
321
322
# File 'lib/resque/data_store.rb', line 320

def increment_stat(stat, by = 1)
  @redis.incrby("stat:#{stat}", by)
end

#stat(stat) ⇒ Object



316
317
318
# File 'lib/resque/data_store.rb', line 316

def stat(stat)
  @redis.get("stat:#{stat}").to_i
end