Sha256: 76ccc968a5eadc0f0c831ba9017d9e1bf466bb8fd8b5e0a4bab96214b090e3c6

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

# frozen_string_literal: true

module ActiveRedisStats
  module Rank
    class Set < ActiveRedisStats::Rank::Base
      class << self

        %i[decrement increment].each do |meth|
          define_method(meth) do |key, val, by: 1|
            ActiveRedisDB::SortedSet
              .send(meth, primary_key(key), val.to_s, by)
          end

          define_method("#{meth}_intervals") do |key, val, by: 1|
            ActiveRedisStats::Base::EXPIRES.each do |frmt, secs|
              ikey = "#{key}:#{interval_key(frmt)}"

              send(meth, ikey, val, by: by)
              expiration(ikey, secs)
            end
          end
        end

      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/rank/set.rb