Class: CanvasSync::JobBatches::Batch::RedisProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/canvas_sync/job_batches/batch.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



582
583
584
585
586
# File 'lib/canvas_sync/job_batches/batch.rb', line 582

def method_missing(method_name, *arguments, &block)
  Batch.redis do |r|
    r.send(method_name, *arguments, &block)
  end
end

Instance Method Details

#multi(*args, &block) ⇒ Object



549
550
551
552
553
554
555
# File 'lib/canvas_sync/job_batches/batch.rb', line 549

def multi(*args, &block)
  Batch.redis do |r|
    r.multi(*args) do |r|
      block.call(r)
    end
  end
end

#pipelined(*args, &block) ⇒ Object



557
558
559
560
561
562
563
# File 'lib/canvas_sync/job_batches/batch.rb', line 557

def pipelined(*args, &block)
  Batch.redis do |r|
    r.pipelined(*args) do |r2|
      block.call(r2 || r)
    end
  end
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


588
589
590
# File 'lib/canvas_sync/job_batches/batch.rb', line 588

def respond_to_missing?(method_name, include_private = false)
  super || Redis.method_defined?(method_name)
end

#uget(key) ⇒ Object



565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/canvas_sync/job_batches/batch.rb', line 565

def uget(key)
  Batch.redis do |r|
    case r.type(key)
    when 'string'
      r.get(key)
    when 'list'
      r.lrange(key, 0, -1)
    when 'hash'
      r.hgetall(key)
    when 'set'
      r.smembers(key)
    when 'zset'
      r.zrange(key, 0, -1)
    end
  end
end