Sha256: 2dad448645ecdfe97cea75e9724b4bfe6930f727e110fa0bcbf7c65a655ef5ef

Contents?: true

Size: 439 Bytes

Versions: 1

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

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

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

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

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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