class Lowkiq::Queue::Queries

Public Class Methods

new(redis_pool, name) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 4
def initialize(redis_pool, name)
  @pool = redis_pool
  @keys = Keys.new name
  @fetch = Fetch.new name
end

Public Instance Methods

fetch(ids) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 120
def fetch(ids)
  @pool.with do |redis|
    _fetch redis, ids
  end
end
morgue_fetch(ids) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 126
def morgue_fetch(ids)
  @pool.with do |redis|
    _morgue_fetch redis, ids
  end
end
morgue_range_by_id(min, max, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 76
def morgue_range_by_id(min, max, limit: 10)
  @pool.with do |redis|
    ids = redis.zrangebylex(
      @keys.morgue_all_ids_lex_zset,
      min, max,
      limit: [0, limit]
    )
    _morgue_fetch redis, ids
  end
end
morgue_range_by_updated_at(min, max, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 98
def morgue_range_by_updated_at(min, max, limit: 10)
  @pool.with do |redis|
    ids = redis.zrangebyscore(
      @keys.morgue_all_ids_scored_by_updated_at_zset,
      min, max,
      limit: [0, limit]
    )
    _morgue_fetch redis, ids
  end
end
morgue_rev_range_by_id(max, min, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 87
def morgue_rev_range_by_id(max, min, limit: 10)
  @pool.with do |redis|
    ids = redis.zrevrangebylex(
      @keys.morgue_all_ids_lex_zset,
      max, min,
      limit: [0, limit]
    )
    _morgue_fetch redis, ids
  end
end
morgue_rev_range_by_updated_at(max, min, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 109
def morgue_rev_range_by_updated_at(max, min, limit: 10)
  @pool.with do |redis|
    ids = redis.zrevrangebyscore(
      @keys.morgue_all_ids_scored_by_updated_at_zset,
      max, min,
      limit: [0, limit]
    )
    _morgue_fetch redis, ids
  end
end
range_by_id(min, max, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 10
def range_by_id(min, max, limit: 10)
  @pool.with do |redis|
    ids = redis.zrangebylex(
      @keys.all_ids_lex_zset,
      min, max,
      limit: [0, limit]
    )
    _fetch redis, ids
  end
end
range_by_perform_in(min, max, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 32
def range_by_perform_in(min, max, limit: 10)
  @pool.with do |redis|
    ids = redis.zrangebyscore(
      @keys.all_ids_scored_by_perform_in_zset,
      min, max,
      limit: [0, limit]
    )
    _fetch redis, ids
  end
end
range_by_retry_count(min, max, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 54
def range_by_retry_count(min, max, limit: 10)
  @pool.with do |redis|
    ids = redis.zrangebyscore(
      @keys.all_ids_scored_by_retry_count_zset,
      min, max,
      limit: [0, limit]
    )
    _fetch redis, ids
  end
end
rev_range_by_id(max, min, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 21
def rev_range_by_id(max, min, limit: 10)
  @pool.with do |redis|
    ids = redis.zrevrangebylex(
      @keys.all_ids_lex_zset,
      max, min,
      limit: [0, limit]
    )
    _fetch redis, ids
  end
end
rev_range_by_perform_in(max, min, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 43
def rev_range_by_perform_in(max, min, limit: 10)
  @pool.with do |redis|
    ids = redis.zrevrangebyscore(
      @keys.all_ids_scored_by_perform_in_zset,
      max, min,
      limit: [0, limit]
    )
    _fetch redis, ids
  end
end
rev_range_by_retry_count(max, min, limit: 10) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 65
def rev_range_by_retry_count(max, min, limit: 10)
  @pool.with do |redis|
    ids = redis.zrevrangebyscore(
      @keys.all_ids_scored_by_retry_count_zset,
      max, min,
      limit: [0, limit]
    )
    _fetch redis, ids
  end
end

Private Instance Methods

_fetch(redis, ids) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 134
def _fetch(redis, ids)
  @fetch.fetch(redis, :multi, ids)
end
_morgue_fetch(redis, ids) click to toggle source
# File lib/lowkiq/queue/queries.rb, line 138
def _morgue_fetch(redis, ids)
  @fetch.morgue_fetch(redis, :multi, ids)
end