Sha256: bdc0264fafd37932350085d3eb63d8a65dd7e189b444373e069a76788be847b2

Contents?: true

Size: 477 Bytes

Versions: 2

Compression:

Stored size: 477 Bytes

Contents

# frozen_string_literal: true

module ActiveRedisStats
  module Count
    class Get < ActiveRedisStats::Count::Base

      class << self
        def total(key)
          ActiveRedisDB::String
            .evaluate
            .find(primary_key(key)) || 0
        end

        def total_intervals(key, format: :month, offset: 0)
          keys = send("#{format}_keys", offset: offset)
          keys.collect { |k| total("#{key}:#{k}") }
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_redis_stats-0.1.2 lib/active_redis_stats/count/get.rb
active_redis_stats-0.1.1 lib/active_redis_stats/count/get.rb