Class: VK::TIMESTAMP
- Inherits:
-
O
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
#ago ⇒ Object
321
322
323
|
# File 'lib/valkey/objects.rb', line 321
def ago
VK.clock.to_i - value.to_i;
end
|
#exist? ⇒ Boolean
318
319
320
|
# File 'lib/valkey/objects.rb', line 318
def exist?
VK.redis.call("GET", key) ? true : false
end
|
#to_time ⇒ Object
324
325
326
|
# File 'lib/valkey/objects.rb', line 324
def to_time
Time.at(value);
end
|
#value! ⇒ Object
315
316
317
|
# File 'lib/valkey/objects.rb', line 315
def value!
VK.redis.call("SET", key, "#{VK.clock.to_i}");
end
|