Sha256: 9ec961b4600224f96962c8da072271846b5946d8a1f255ab831263515930d8aa

Contents?: true

Size: 380 Bytes

Versions: 1

Compression:

Stored size: 380 Bytes

Contents

class Rediscan
  def initialize(redis)
    @redis = redis
    @cursor = "0"
  end

  def each(match: nil, count: nil, &block)
    done = false
    args = []
    args.push("MATCH", match) if match
    args.push("COUNT", count) if count

    until done
      @cursor, keys = @redis.call("SCAN", @cursor, *args)
      done = @cursor == "0"

      keys.each(&block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rediscan-0.0.1 lib/rediscan.rb