Sha256: a2c1defd9b6ac7852e9c7ee2f0fcc27018acf32b6cace0ba5dfb4aa48e47aa48

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 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 = keys.collect { |k| primary_key("#{key}:#{k}") }

          ActiveRedisDB::String
            .evaluate
            .find_each(*keys)
            .map(&:to_i)
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_redis_stats-0.1.3 lib/active_redis_stats/count/get.rb