Sha256: 0574833b5f68bd6334ca77b1898770f00927fa966a3a557d14eba66369f455ec

Contents?: true

Size: 381 Bytes

Versions: 16

Compression:

Stored size: 381 Bytes

Contents

class RedisResultRowCount
  EXPIRY = 1.hour

  def initialize(result)
    @result = result
    @redis = Redis.current
  end

  def ongoing_row_count
    @redis.get(redis_key)
  end

  def increment_count_by(amount)
    @redis.incrby(redis_key, amount)
  end

  def expire
    @redis.expire(redis_key, EXPIRY)
  end

  private

  def redis_key
    "{@result.id}_rowcount"
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev lib/redis_result_row_count.rb
aleph_analytics-0.4.8 lib/redis_result_row_count.rb
aleph_analytics-0.4.7 lib/redis_result_row_count.rb
aleph_analytics-0.4.4 lib/redis_result_row_count.rb
aleph_analytics-0.4.2 lib/redis_result_row_count.rb
aleph_analytics-0.4.1 lib/redis_result_row_count.rb
aleph_analytics-0.3.0 lib/redis_result_row_count.rb
aleph_analytics-0.2.0 lib/redis_result_row_count.rb
aleph_analytics-0.1.0 lib/redis_result_row_count.rb
aleph_analytics-0.0.6 lib/redis_result_row_count.rb
aleph_analytics-0.0.5 lib/redis_result_row_count.rb
aleph_analytics-0.0.4 lib/redis_result_row_count.rb
aleph_analytics-0.0.3 lib/redis_result_row_count.rb
aleph_analytics-0.0.2 lib/redis_result_row_count.rb
aleph_analytics-0.0.1.alpha lib/redis_result_row_count.rb
aleph_analytics-0.0.0.alpha lib/redis_result_row_count.rb