Class: VK::HASH

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, #value

Constructor Details

This class inherits a constructor from VK::O

Instance Method Details

#[](k) ⇒ Object



450
451
452
# File 'lib/valkey/objects.rb', line 450

def [] k
  VK.redis.call("HGET", key, k);
end

#[]=(k, v) ⇒ Object



453
454
455
# File 'lib/valkey/objects.rb', line 453

def []= k,v
  VK.redis.call("HSET", key, k, v);
end

#to_hObject



459
460
461
# File 'lib/valkey/objects.rb', line 459

def to_h
  VK.redis.call("HGETALL", key);
end

#update(h = {}) ⇒ Object



456
457
458
# File 'lib/valkey/objects.rb', line 456

def update(h={})
    h.each_pair { |k,v| VK.redis.call("HSET", key, k, v); }
end