Class: Kredis::Types::Counter
- Defined in:
- lib/kredis/types/counter.rb
Instance Attribute Summary collapse
-
#expires_in ⇒ Object
Returns the value of attribute expires_in.
Attributes inherited from Proxying
Instance Method Summary collapse
Methods inherited from Proxying
Constructor Details
This class inherits a constructor from Kredis::Types::Proxying
Instance Attribute Details
#expires_in ⇒ Object
Returns the value of attribute expires_in.
4 5 6 |
# File 'lib/kredis/types/counter.rb', line 4 def expires_in @expires_in end |
Instance Method Details
#increment(by: 1) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/kredis/types/counter.rb', line 6 def increment(by: 1) multi do set 0, ex: expires_in, nx: true incrby by end end |
#value ⇒ Object
13 14 15 |
# File 'lib/kredis/types/counter.rb', line 13 def value get.to_i end |