Sha256: 79bd3a027b5dbaf190ad65647a1691ebabbe6f5e4c47c2c88004e05983e16639

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

require_relative "base"

module SidekiqAlive
  module Redis
    # Wrapper for redis client used by sidekiq < 7
    #
    class Client < Base
      def set(key, time:, ex:)
        redis.set(key, time, ex: ex)
      end

      def match(key)
        keys = []
        cursor = 0

        loop do
          cursor, found_keys = redis.scan(cursor, match: key, count: 1000)
          keys += found_keys if found_keys
          break if cursor.to_i == 0
        end
        keys
      end

      def delete(key)
        redis.del(key)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq_alive-2.1.9 lib/sidekiq_alive/redis/client.rb
sidekiq_alive-2.1.8 lib/sidekiq_alive/redis/client.rb