Sha256: d911830ed7aed2e409a72374f05cd3752a5e2411623ebd4eb77d14a6f84ce14f
Contents?: true
Size: 289 Bytes
Versions: 2
Compression:
Stored size: 289 Bytes
Contents
class Kredis::Types::Counter < Kredis::Proxy def initialize(redis, key, expires_in: nil) @expires_in = expires_in super redis, key end def increment(by: 1) multi do set 0, ex: @expires_in, nx: true incrby by end end def value get.to_i end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kredis-0.1.1 | lib/kredis/types/counter.rb |
kredis-0.1.0 | lib/kredis/types/counter.rb |