Class: VK::QUEUE

Inherits:
O
  • Object
show all
Defined in:
lib/valkey/objects.rb

Instance Attribute Summary

Attributes inherited from O

#key

Instance Method Summary collapse

Methods inherited from O

#delete!, #expire, #initialize

Constructor Details

This class inherits a constructor from VK::O

Instance Method Details

#<<(i) ⇒ Object



477
478
479
# File 'lib/valkey/objects.rb', line 477

def << i
  VK.redis.call("RPUSH", key, i)
end

#frontObject



480
481
482
# File 'lib/valkey/objects.rb', line 480

def front
  VK.redis.call("LPOP", key)
end

#lastObject



471
472
473
# File 'lib/valkey/objects.rb', line 471

def last
		VK.redis.call("LRANGE", key, -1,-1)[0]
end

#lengthObject



474
475
476
# File 'lib/valkey/objects.rb', line 474

def length
  VK.redis.call("LLEN", key)
end

#value(&b) ⇒ Object



465
466
467
468
469
470
# File 'lib/valkey/objects.rb', line 465

def value &b
  VK.redis.call("LRANGE", key, 0, -1).each_with_index { |e, i| b.call(i, e) }
  if @opts.has_key?(:flush) == true
    delete!
  end
end