ryz310/redis-objects-periodical

View on GitHub
lib/redis/recurring_at_intervals/hourly.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

class Redis
  module RecurringAtIntervals
    module Hourly
      private

      def redis_periodical_field_key(time)
        time_key = time.strftime('%Y-%m-%dT%H')
        [original_key, time_key].flatten.join(':')
      end

      def next_key(time, length = 1)
        time + (3600 * length)
      end
    end
  end
end