Class: CanvasSync::JobBatches::Batch::RedisProxy
- Inherits:
-
Object
- Object
- CanvasSync::JobBatches::Batch::RedisProxy
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
471
472
473
474
475
|
# File 'lib/canvas_sync/job_batches/batch.rb', line 471
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
434
435
436
437
438
439
440
|
# File 'lib/canvas_sync/job_batches/batch.rb', line 434
def multi(*args, &block)
Batch.redis do |r|
r.multi(*args) do |r|
block.call(r)
end
end
end
|
#pipelined(*args, &block) ⇒ Object
442
443
444
445
446
447
448
449
450
451
452
|
# File 'lib/canvas_sync/job_batches/batch.rb', line 442
def pipelined(*args, &block)
Batch.redis do |r|
if block.arity == 1
r.pipelined(*args) do
block.call(r)
end
else
r.pipelined(*args, &block)
end
end
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
477
478
479
|
# File 'lib/canvas_sync/job_batches/batch.rb', line 477
def respond_to_missing?(method_name, include_private = false)
super || Redis.method_defined?(method_name)
end
|
#uget(key) ⇒ Object
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
|
# File 'lib/canvas_sync/job_batches/batch.rb', line 454
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
|