Class: VK::S

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

#initialize

Constructor Details

This class inherits a constructor from VK::O

Instance Method Details

#[](k) ⇒ Object



175
176
177
# File 'lib/valkey/objects.rb', line 175

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

#[]=(k, v) ⇒ Object



178
179
180
# File 'lib/valkey/objects.rb', line 178

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

#poke(k, n) ⇒ Object



181
182
183
# File 'lib/valkey/objects.rb', line 181

def poke k, n
  VK.redis.call("ZINCRBY", key, n.to_f, k);
end

#value(&b) ⇒ Object



172
173
174
# File 'lib/valkey/objects.rb', line 172

def value &b
  VK.redis.call("ZREVRANGE", key, 0, -1, 'WITHSCORES').each_with_index { |e, i| b.call(i, e) }
end