module Tally

Constants

VERSION

Public Class Methods

increment(*args) click to toggle source
# File lib/tally.rb, line 72
def self.increment(*args)
  Increment.public_send(:increment, *args)
end
redis(&block) click to toggle source

If sidekiq is available, piggyback on its pooling

Otherwise, just use redis directly

# File lib/tally.rb, line 54
def self.redis(&block)
  raise ArgumentError, "requires a block" unless block_given?

  if defined?(Sidekiq)
    Sidekiq.redis(&block)
  else
    block.call(redis_connection)
  end
end
redis_connection() click to toggle source
# File lib/tally.rb, line 64
def self.redis_connection
  @redis_connection ||= Redis.current
end
redis_connection=(connection) click to toggle source
# File lib/tally.rb, line 68
def self.redis_connection=(connection)
  @redis_connection = connection
end