Class: VK::CORPUS

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



669
670
671
672
673
674
675
# File 'lib/valkey/objects.rb', line 669

def [] i      
  if VK.redis.call("SMISMEMBER", _set, i)[0] == 0
    VK.redis.call("SADD", _set, i)
    VK.redis.call("HSET", _index, i, length);
  end
  return VK.redis.call("HGET", _index, i)
end

#_indexObject



660
661
662
# File 'lib/valkey/objects.rb', line 660

def _index
    %[#{key}-hash]
end

#_setObject



657
658
659
# File 'lib/valkey/objects.rb', line 657

def _set
    %[#{key}-sset]
end

#lengthObject



663
664
665
# File 'lib/valkey/objects.rb', line 663

def length
  VK.redis.call("SCARD", _set)
end

#value(&b) ⇒ Object



666
667
668
# File 'lib/valkey/objects.rb', line 666

def value &b
  VK.redis.call("HGETALL", _index).each_pair { |e, i| b.call(i, e) }
end