module RedisModel::Types::Counter
Internal: Methods needed for counter data type.
Public Instance Methods
incr(by = nil)
click to toggle source
Public: Atomically increments counter value using Redis command INCR or INCRBY.
by - Amount to increment by (default: 1).
Returns Integer
value of counter after increment.
# File lib/redis_model/types/counter.rb, line 13 def incr(by = nil) by ? connection.incrby(key_label, by) : connection.incr(key_label) end